Hi i cre开发者_如何转开发ated 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.
Can you try passing @object to your helper method?
def processed_pagination(@object)
content_tag(:div, will_paginate(@object), :class=>"list-pagination")
end
In your view you can do:
processed_pagination(@object)
精彩评论