I’ve read the documentation, but I’m still not sure I understand everything.
Especially why there’s a :new parameter. As far as I understand, it could be replaced with the :collection parameter.
So what’s the difference between those three types of routes?
The difference is the URL generated.
Let’s guess three resources :
The first route will create :
With nothing between the controller name and the action name. We don’t need any other parameter to get the user’s list rss feed.
The second one will create the action “profile” as a member of the object. So we’ll have :
The “1” is the user’s
to_param. We need a user’s id to display a profile.The third one will create the action “draft” as a member of the new action. So we’ll have :
The “draft” action displays a draft of the user before accepting its creation.
So that’s the difference between :collection, :member and :new. Every of them creates different routes, each one with their own purpose.