Recent Routing changes in edge rails?

Does anyone have a link to where they changed the routing behavior in
edge rails with in the last 3 weeks? Or can give a brief overview of the
changes?

Seems for example the below went from:

messages: GET /:user_id/messages/
{:action=>“index”, :controller=>“messages”}

To this:

user_messages: GET /:user_id/messages/
{:controller=>“messages”, :action=>“index”}

This happened between revision 6518 and revision 6654 in edge rails.

Route is defined as:

map.resources :users do |user|
user.resources :messages, :path_prefix => ‘:user_id’
end

Thanks

  • John

user_messages: GET /:user_id/messages/
{:controller=>“messages”, :action=>“index”}

This happened between revision 6518 and revision 6654 in edge rails.

Route is defined as:

map.resources :users do |user|
user.resources :messages, :path_prefix => ‘:user_id’
end

This is done to prevent namespace classes. If you wish to get the old
behavior, you can do :name_prefix => nil.

The preferred way to do what you’re doing is now:

map.resources :users, :has_many => :messages

map.resources :users, :has_many => :messages

Ahh, thanks, I see it here now:http://dev.rubyonrails.org/changeset/6588

Can you still specify a :path_prefix with the new way (has_many)?

No. If you want to use options outside of the convention, you’ll still
need to work with a block. The block will remain in place for those
(presumably rare) instances.

Route is defined as:

map.resources :users do |user|
user.resources :messages, :path_prefix => ‘:user_id’
end

This is done to prevent namespace classes. If you wish to get the old
behavior, you can do :name_prefix => nil.

The preferred way to do what you’re doing is now:

map.resources :users, :has_many => :messages

Ahh, thanks, I see it here now:
http://dev.rubyonrails.org/changeset/6588

Can you still specify a :path_prefix with the new way (has_many)?

For example if I wanted the prefix to be :user_login?

I have not fixed all the routes yet to test this.

Thank you,

  • John

The preferred way to do what you’re doing is now:

map.resources :users, :has_many => :messages

I am digging on this syntax. More terse and make sense in the context
of Rails/ActiveRecord.

I did get tripped up a bit by the changing of the _url and _path
methods.

http://tuples.us/2007/05/02/changes-to-nested-resource-routes/

Jordan