Hi i created my own helper and passed the array of objects to it. And from there i want to get the pagination results.
content_tag(:div, will_paginate(@object), :class=>"list-pagination")
but it is generating error
ActionView::Template::Error (undefined method 'get?' for nil:NilClass):
I also tried to include in the class
but no way, error is still there.
Where did you define this helper? Which version of Rails?
I created it in ApplicationHelper
I'm guessing this is Rails 3.0.9.
Where are you calling processed_pagination from? Regular view template, or somewhere else?
Your error is because the request object is missing, which means that you might be rendering pagination links outside of the context of a request/response cycle.
Yes, i was calling in in class, which was in lib. Actually i was writing a plugin to show list of objects based on some selection. Then how to solve this issue?
OK I did a few tweaks in b385f38 and wrote tests to confirm it works. Switch your Gemfile to use will_paginate from git master and you can try it out:
default_url_options[:controller] = 'home'
# if you want full URLs:
default_url_options[:host] = 'example.com'
# if you want only paths:
default_url_options[:only_path] = true