Kaminari分页宝石存在嵌套资源的问题 [英] Problem with nested resources with Kaminari pagination gem

查看:75
本文介绍了Kaminari分页宝石存在嵌套资源的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Kaminari似乎无法正确处理嵌套资源.这是我的问题的描述.想知道是否有人能够解决这个问题.

Can't seem to get Kaminari to work properly with nested resources. Here is a description of my problem. Wondering if anybody was able to tackle this issue.

我的路线如下:

resources :artists do
  resources :paintings
end

我认为,我有:

<%= paginate @paintings, :params => { :controller => 'paintings', :action => 'index' } %>

初始/基本网址如下:

http://localhost/artists/foobar/paintings

但是,点击kaminari分页链接会呈现如下网址:

But clicking on a kaminari paginate link, renders the url like this:

http://localhost/paintings?artist_id=foobar&page=2

应该是:

http://localhost/artists/foobar/paintings?page=2

推荐答案

糟糕.刚意识到,显然要优先考虑一条路线....

Ooops. Just realised, apparently a route was being prioritized....

似乎现在可以工作...

Seems to work now...

这篇关于Kaminari分页宝石存在嵌套资源的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆