Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 是否会将混淆的URL与经过身份验证的根路由进行分页_Ruby On Rails_Ruby On Rails 4_Devise_Will Paginate - Fatal编程技术网

Ruby on rails 是否会将混淆的URL与经过身份验证的根路由进行分页

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

我的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_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