Displaying 2 results from an estimated 2 matches for "find_with_some_custom_method".
2005 Dec 19
6
custom find methods and pagination
i''ve got several methods in my models i use to find based on certain
criteria...i''ve done this so the controller code is less cluttered, plus the
DRY factor.
example:
class Foo < ActiveRecord::Base
def find_by_something(something)
find :all, :joins => ..., :conditions => ...
end
def find_by_something_else(something_else)
find :all, :joins => ...,
2007 Jun 20
1
Count_by_content ??
...item_count = Item.count_with_some_custom_method()
# step 3: create a Paginator, the second argument has to be the
number of ALL items on all pages
@item_pages = Paginator.new(self, item_count, items_per_page, page)
# step 4: only find the requested subset of @items
@items = Item.find_with_some_custom_method(items_per_page, offset)
end
--
Posted via http://www.ruby-forum.com/.