Difference between :as option in Rails 2 and Rails3 routing? -


in rails 2.x have:

 map.resources :posts, :controller => 'posts', :as => 'articles' 

this creates alias our posts routes. example, sends "domain.com/articles/" posts controller index action.

in rails3, however, :as option behaves differently. example:

 resources :posts, :controller => 'posts', :as => 'articles' 

sets named route rather alias, , going "domain.com/articles/" gives error:

no route matches {:controller=>"posts"} 

how old (rails 2) :as behavior using new (rails 3) api?

ps: please don't tell me rename controller. that's not option me.

from cursory reading of ror guide on routing, think might need try:

resources :articles, :controller => "posts" 

(http://guides.rubyonrails.org/routing.html#specifying-a-controller-to-use)

you might need add :as => "articles", named helper might set since adding :articles resources.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -