Is there a way to limit or put a condition on a find that’s written
like: @customer.orders
something like, @customer.orders(:limit => 10)
Would I have to modify the model?
Thanks,
Chad
Is there a way to limit or put a condition on a find that’s written
like: @customer.orders
something like, @customer.orders(:limit => 10)
Would I have to modify the model?
Thanks,
Chad
You can use find again with a collection descended like that:
@customer.orders.find(:all, :limit => 10) would accomplish what you
want
there, and it would provide the SQL necessary to make the join.
D. Taylor S.,
Reality Technician
On 12/20/06, Chad [email protected] wrote:
Thanks,
Chad
–
D. Taylor S.
Reality Technician
“Look at my hair; like the design.” – David Byrne
easy enough
On Dec 20, 11:39 am, “D. Taylor S.”
In your Customer model use this:
has_many :orders, :limit => 10
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs