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 received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 Singletary, Reality Technician On 12/20/06, Chad <carimura-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > 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 > > > > >-- D. Taylor Singletary Reality Technician "Look at my hair; like the design." -- David Byrne --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
easy enough On Dec 20, 11:39 am, "D. Taylor Singletary" <taylorsinglet...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 Singletary, > Reality Technician > > On 12/20/06, Chad <carim...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > 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-- > D. Taylor Singletary > Reality Technician > "Look at my hair; like the design." -- David Byrne--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
In your Customer model use this: has_many :orders, :limit => 10 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---