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?
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?
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
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