Displaying 2 results from an estimated 2 matches for "complete_videos".
2007 Apr 04
1
[PLUGIN] count_from_query - easily convert finder queries into count queries
count_from_query gives you the ability to generate a COUNT query from
a standard Rails find.
For example, if you have the query
User.find :all
it would be trivial to get a count:
User.count
however, if you have a more specific finder method, such as
class Company < ActiveRecord::Base
def complete_videos
Video.find :all, :conditions => "company_id=#{id} AND
status=''complete''", :order => "created_at DESC"
end
end
Getting the count isn''t quite as easy. You could just call #size on
the returned array, but it''s wasteful if you don''...
2007 Apr 04
2
[PLUGIN] ArPaginator - Allows you to easily paginate over any existing AR queries.
The built-in Rails pagination is fairly limited...you pass in the
model name, and optionally some conditions, and it generates a
paginated query for you. This gets to be very bad if you''ve got any
custom queries.
class Company < ActiveRecord::Base
def complete_videos
Video.find :all, :conditions => "company_id=#{id} AND
status=''complete''", :order => "created_at DESC"
end
end
You wouldn''t be able to easily paginate over that query. You''d end up
doing something like this in your controller:
@vi...