我收到错误没有路由匹配{:action =>“index”,:controller =>“search”}
使用时
link_to "Next Page", {:controller => 'search', :action => 'index'}
My routes.rb contains
resources :search, only: [:index]
当我使用
时,动作正常link_to "Next Page", '/search'
耙路线结果
Prefix Verb URI Pattern Controller#Action
errors_cookie GET /errors/cookie(.:format) errors#cookie
GET /categories(/:level1)(/:level2)(/:level3)(.:format) search#categories
GET /category/filter/:type(.:format) search#category_filter_sort
brand GET /brand(.:format) search#brand
GET /brand/filter/:type(.:format) search#brand_filter_sort
search_index GET /search(.:format) search#index
search_suggest GET /search/suggest(.:format) search#suggest
search_list GET /search/list(.:format) search#list
GET /search/filter/:type(.:format) search#filter_sort
GET /sd/:slug(.:format) search#show
GET /sd/compare/:id(.:format) search#compare
delete_favourites POST /favourites/delete(.:format) favourites#delete
usuals_favourites GET /favourites/usuals(.:format) favourites#usuals
orders_favourites GET /favourites/orders(.:format) favourites#orders
favourites GET /favourites(.:format) favourites#index
POST /favourites(.:format) favourites#create
Routes for Spree::Core::Engine:
spree_user_omniauth_authorize GET|POST /users/auth/:provider(.:format) spree/omniauth_callbacks#passthru {:provider=>/facebook|twitter|github|google_oauth2|amazon/}
spree_user_omniauth_callback GET|POST /users/auth/:action/callback(.:format) spree/omniauth_callbacks#:action
Routes for Ahoy::Engine:
visits POST /visits(.:format) ahoy/visits#create
events POST /events(.:format) ahoy/events#create
答案 0 :(得分:0)
它是一个狂欢应用程序,控制器继承自Spree :: BaseController。 url_for只能看到狂欢引擎中的路由而不是全局
通过将main_app添加到url_for main_app.url_for(...)
将此monkey patch用于kaminari
感谢您的时间亚历山大。