我在控权人中有这样的行动:
class ArtLookupsController < ApplicationController
def search
****
@pre_articles_result = ArtLookup.search(s_query)
@articles_result = Kaminari.paginate_array(@pre_articles_result).page(params[:page]).per(70)
***
end
end和路线:
match '/search' => 'art_lookups#search', :as => :search_art_lookup和部分观点:
= paginate @articles_result 当我插入一些文本来搜索,我得到的结果,一切都好,限制在70个条目(链接是:**:3000/搜索).但是,当我单击其他页面时,例如第3-d链接是::3000/art_lookups/search?authenticity_token=ve%2FrRQoXIHPQ9BAN07RLCMF59bB0HVlEcNn%2Flxd4f64%3D&page=3&search=1234&utf8=✓。
我得到了错误:Unknown action The action 'show' could not be found for ArtLookupsController,但为什么?我怎么才能解决这个问题?所以如果我点击页码,我会得到其他的结果.?我也试过match '/search(/:page)' => 'art_lookups#search', :as => :search_art_lookup
发布于 2013-09-05 07:19:23
我认为您可以这样修改您的routes.rb:
match '/search(/:page)‘=> 'artLookups#search',:controller => 'artLookups',:action => 'search’
https://stackoverflow.com/questions/14536768
复制相似问题