I have a very simple question. Trying to figure out what is the simplest way to route the custom action in rails 3.
Let's say i have controller UsersController and action promote_to_premium 
Nor
http://localhost:3000/users/#{user_id}/promote_to_premium  
neither
http://localhost:3000/users/promote_to_premium/#{user_id}
works.
Should I specify in routes.rb every custom action that differs from new/delete/update/create/ect/....?????
Thank You.
Yes you need to specify in your routes.rb.
Example:
resources :users do
  member do
    post :promote_to_premium
  end
end
This way you can access the route like this:
http://localhost:3000/users/#{user_id}/promote_to_premium
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With