开发者

Rails: what is wrong with this route?

开发者 https://www.devze.com 2023-01-17 07:11 出处:网络
For some strange reason cardsets_path(\'my\') generates \"/cardsets.my\" instead of \"/cardsets/my\". Please explain why?

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

精彩评论

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