Ruby on rails 是否会将混淆的URL与经过身份验证的根路由进行分页
我的routes.rb中包含以下内容:Ruby on rails 是否会将混淆的URL与经过身份验证的根路由进行分页,ruby-on-rails,ruby-on-rails-4,devise,will-paginate,Ruby On Rails,Ruby On Rails 4,Devise,Will Paginate,我的routes.rb中包含以下内容: ... authenticated :user do root to: 'game_shelves#index', as: :authenticated_root end unauthenticated do root to: 'editions#index' end ... resources :editions, :path => "games" do collection do get 'to_revie
...
authenticated :user do
root to: 'game_shelves#index', as: :authenticated_root
end
unauthenticated do
root to: 'editions#index'
end
...
resources :editions, :path => "games" do
collection do
get 'to_review'
post 'review'
get 'existing_work'
end
member do
put 'split'
end
resources :expansions do
end
end
...
will_paginate是这样的:
<%= will_paginate @collection, renderer: BootstrapPagination::Rails %>
结果链接如下所示:
<%= will_paginate @collection, renderer: BootstrapPagination::Rails %>
如果我将未经验证的根目录设置为其他版本#索引,则链接是正确的,如下所示:
<%= will_paginate @collection, renderer: BootstrapPagination::Rails %>
我试过用这个:
<%= will_paginate @collection, :params => {:controller => '/editions', :action => 'index'}, renderer: BootstrapPagination::Rails %>
{:controller=>'/editions',:action=>'index'},呈现器:BootstrapPagination::Rails%>
但这并不强迫威尔·帕吉纳使用正确的路线。如果我试试这个:
<%= will_paginate @collection, :params => {:controller => editions_path }, renderer: BootstrapPagination::Rails %>
{:controller=>editions\u path},呈现器:BootstrapPagination::Rails%>
Rails给了我路由错误:
没有路由匹配{:action=>“index”,:controller=>“games”,:page=>2}
我已经反转了我的routes.rb,现在它可以工作了。看来秩序很重要,我不知道
...
resources :editions, :path => "games" do
collection do
get 'to_review'
post 'review'
get 'existing_work'
end
member do
put 'split'
end
resources :expansions do
end
end
authenticated :user do
root to: 'game_shelves#index', as: :authenticated_root
end
unauthenticated do
root to: 'editions#index'
end