Reputation: 24886
I have a named route to the user's inbox, which is maintained by the messages resource. I want to make sure that the users can only access their inbox from my named path, and remove "/messages" as an option.
resources :messages
match "/u/:nickname/inbox" => "messages#index", :as=>:inbox
Is there a simple way of doing that? Do I have to just create a matching path for "/messages"?
Upvotes: 0
Views: 312
Reputation: 21487
Solution 1:
I'd create a path for messages and remove resources :messages
This approach will delete all the normal routes for messages and you'll have to re-add the ones you want available.
Solution 2:
Only remove the index option for the routes and allow all other standards routes to be the same.
resources :messages, :except => :index
match "/u/:nickname/inbox" => "messages#index", :as=>:inbox
Upvotes: 2