Change namespace of model for routes in rails
I have a model named WidgetList
that i would like mapped to the ListsController
. So when i
<%= render @widget_list %>
it will render /lists/_list.html.erb
and when I have <%= form_for @widget_list do |f| %>
it will go to /lists/{create/update}.html.erb
. Or when in my controller i respond_with @widget_list
it will know to use the list/show.html.erb
, how ca开发者_如何学Cn i tell rails that WidgetLists
need to use the ListsController
?
Is there a way to change this mapping without having to re-name WidgetList ?
You may use the :controller option together with :path:
resources :widget_lists, :path => "lists", :controller => "lists"
精彩评论