Thursday, August 26, 2010

[Rails] Rails 3 named routes

Hello,
In Rails 2 the following works:
map.resources :domains, :as => 'domainek', :path_names => { :new =>
'uj', :edit => 'szerkesztes' }
In Rails 3 what is the good way to do this?
Basically when I write domainek/uj I want to use the domains
controller with new, etc.

Well, the straight way of doing it would be:

match 'domainek/uj' => 'domains#new', :as => :static
match 'domainek/szerkesztes' => 'domains#edit', :as => :static
match 'domainek' => 'domains', :as => :static

But then new_domain_path does not work in the views, plus the above is
not very rails like.

Can you please tell me what's the good way of doing it in Rails 3.
Thank you.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate