Routing custom action in Rails 3

ruby-on-rails, ruby-on-rails-3

Solution

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

Problem

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.

Original source