I have a controller and list page for region object. My list page has a
‘name’ text input that can be used to limit the list.
It works except that the paginate gets the full set of regions
by my search term. I believe this full list is contained in :regions
which I dont seem to be allowed to modify or replace (yes I am a ruby
rails newb). How can I paginate the set my region_search method returns
rather than all the regions in my database? Thanks.
regions = Region.find(:all, :conditions => [“name like ?”, “%” <<
params[:name].to_s << “%”])
if params[:name].nil? or params[:name].eql?([""])
logger.info(“name is nil or empty”)
@region_pages, @regions= paginate :regions, :per_page => 10
logger.info(“name is not empty”)
#this is kinda weird, seem to need the following line for some
#I guess the page expects it
@region_pages, region_search= paginate :regions, :per_page => 10