How to change the controller path of a link in rails 3?
How do I get:
<%= link_to 'Back', originalcontrollers_path %>
to be开发者_StackOverflow中文版:
<%= link_to 'Back', modifiedcontrollers_path %>
I already have my route updated with:
get "modifiedcontrollers", :to => "originalcontrollers#index"
So the "/modifiedcontroller" url works the same as "/originalcontroller". When creating links I need it to point to the new url. How would I do this?
I am not sure I understand you, but try this:
get "modifiedcontrollers", :to => "originalcontrollers#index", :as => :modifiedcontrollers
get "modifiedcontrollers/new", :to => "originalcontrollers#new", :as => :new_modifiedcontroller
...
so if you need all stack of routes:
resources :modifiedcontrollers, :controller => :originalcontrollers
so now this will work as expected
<%= link_to 'Back', modifiedcontrollers_path %>
精彩评论