Rails: what is wrong with this route?
For some strange reason cardsets_path('my') generates "/cardsets.my" instead of "/cardsets/my". Please explain why?
config/routes.rb:
match '/cardsets/:type', :to => 'cardsets#index', 开发者_开发百科:requirements => { :type => /my|public/ }, :as => 'cardsets'
resources :users do
resources :cardsets do
end
end
rake routes:
cardsets /cardsets/:type(.:format) {:controller=>"cardsets", :action=>"index"}
Shouldn't it be
cardsets_path(:type => 'my')
However, type is a reserved word in rails.
精彩评论