Displaying 2 results from an estimated 2 matches for "paginator_options".
2006 Apr 13
2
Dynamic finder conditions
...om_hash(some_hash)
condition = ''''
some_hash.each_pair {|key, value|
if value.empty?
next
end
condition << "#{key} LIKE ''%#{value}%'' AND "
}
condition[0..-5].to_s
end
--some_controller.rb
def list
paginator_options = {:per_page => 10}
conditions = dynamic_conditions_from_hash(params, Item)
unless conditions.empty?
paginator_options.merge!({:conditions => conditions})
end
@item_pages, @items = paginate :items, paginator_options
end
Thanks, and I hope this helps!
Daniel
2006 Apr 20
0
paginate :includes not working as I thought it should
Hello everyone, I have the code below:
paginator_options.merge!({:conditions => ''cities.id = 4'', :include =>
[:cities]})
@people_pages, @people = paginate :people, paginator_options
There''s a many-to-many relationship between people and cities.
It seemed like before this was working, but now in the sql that''s...