Is there a way to tell if an association on an object is cached without hitting the db? For example, let''s say I have order has_many line_items, is there a way for me to tell if order.line_items is already populated? -- Posted via http://www.ruby-forum.com/.
Frederick Cheung
2009-Oct-20 07:17 UTC
Re: Check if association cached without hitting db?
On Oct 20, 12:35 am, Raymond O''Connor <rails-mailing-l...@andreas- s.net> wrote:> Is there a way to tell if an association on an object is cached without > hitting the db? > > For example, let''s say I have order has_many line_items, is there a way > for me to tell if order.line_items is already populated?I think you can do order.line_items.loaded? Fred> -- > Posted viahttp://www.ruby-forum.com/.