20th Mon
リソースにカスタムアクションを追加する方法のメモ
Merbでconfig/router.rbの中で、リソースのカスタムアクションを追加する方法のメモ。
ruby>>
resource :users,
:collection => {:active => :get},
:member => {:password => :get}
<<--
:collectionで指定したアクションは、resource(:users, :active) などのように参照できて、"/users/active" のような感じになります。
:memberで指定したアクションは、resource(@user, :password) などのように参照できて、"/users/1/password" のようなスタイルになります。
posted by
genki on Mon 20 Apr 2009 at 14:54 with 0 comments