开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜