Newbie question, adding conditions to collection of sql objs

I have:

@[email protected]

How do I add limit and order_by conditions. I have tried the following:

@c.pictures.find_all(:limit=>5)

@c.pictures, :limit=>5

@c.pictures :limit=>5

None of these work.

ok, im using @c.pictures.find(:all, :limit=>5)

Is that the right way?
Eric G. wrote:

I have:

@[email protected]

How do I add limit and order_by conditions. I have tried the following:

@c.pictures.find_all(:limit=>5)

@c.pictures, :limit=>5

@c.pictures :limit=>5

None of these work.

Yes, that is the right way, and to add an order, just use :order. For
example:

@model.find(:all, :order => ‘created_at DESC’, :limit => 5)

On 8/2/06, Eric G. [email protected] wrote:

Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Tom D.

http://atomgiant.com
http://gifthat.com

Eric,

@c.pictures.find :all, :conditions => […], :order => …

Zack