如何将 will_paginate 方法添加到 rails 中的 where 条件
How can i add will_paginate method to where condition in rails
这是我要应用分页方法的控制器。
我需要`@products = Product.where(value: @type.value).paginate(page: params[:page]) 旁边的分页方法 #But this is not working.
这是我的控制器[1]:https://i.stack.imgur.com/QlgGW.png
这是生成的错误 [2]:https://i.stack.imgur.com/f12py.png
有什么方法可以在不改变很多东西的情况下添加方法。
这是我遇到的错误
@product_types 变量似乎是空的。您是否忘记为 will_paginate 传递集合对象?
提取的源代码(大约第 17 行):
</div>
<%= will_paginate %>
<div class="container">
<div class="row">
#will_paginate
需要一个集合作为参数。
<%= will_paginate @products %>
这是我要应用分页方法的控制器。
我需要`@products = Product.where(value: @type.value).paginate(page: params[:page]) 旁边的分页方法 #But this is not working.
这是我的控制器[1]:https://i.stack.imgur.com/QlgGW.png
这是生成的错误 [2]:https://i.stack.imgur.com/f12py.png
有什么方法可以在不改变很多东西的情况下添加方法。
这是我遇到的错误
@product_types 变量似乎是空的。您是否忘记为 will_paginate 传递集合对象?
提取的源代码(大约第 17 行):
</div>
<%= will_paginate %>
<div class="container">
<div class="row">
#will_paginate
需要一个集合作为参数。
<%= will_paginate @products %>