如何在我自己的助手中使用将分页助手
您好,我创建了自己的助手并将对象数组传递给它。从那里我想获得分页结果。
def processed_pagination
content_tag(:div, will_paginate(@object), :class=>"list-pagination")
end
但它正在生成错误
ActionView::Template::Error (undefined method 'get?' for nil:NilClass):
我也尝试包含在类中
include ActionView::Helpers::UrlHelper
include Rails.application.routes.url_helpers
,但没办法,错误仍然存在。
任何人都可以指导我吗?
Hi i created my own helper and passed the array of objects to it. And from there i want to get the pagination results.
def processed_pagination
content_tag(:div, will_paginate(@object), :class=>"list-pagination")
end
but it is generating error
ActionView::Template::Error (undefined method 'get?' for nil:NilClass):
I also tried to include in the class
include ActionView::Helpers::UrlHelper
include Rails.application.routes.url_helpers
but no way, error is still there.
Can any one guide me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试将 @object 传递给您的辅助方法吗?
在您看来您可以这样做:
Can you try passing @object to your helper method?
In your view you can do: