Rails ActiveRecord - eager loading (sort of) when using 'build' from has_many -


I have a situation where children have been created, but have not been saved, and then parents' references Is being used in the scene with. This has extensive use of rail record caching. I have to 'curious load' parents with childhood records.

  class guardian & lt; ActiviverCord :: Base is_Im: Kids Deaf Make-Childer Loop .. Bal_Are & lt; & Lt; Children (Construction) End End  

Then in the scene (note that 'child' has not been saved in DB):

  children_re.each Do it Children # What is the best way to optimize this, does it not choose the parent only from the cash? Child.parent end  

I'm not sure that I understand the problem. Query cache is your friend ...! You are not calling the database that you are calling on .parent .

If you can include more information about what you are trying to do, then it may be easier to help with the problem.


Comments

Popular posts from this blog

MVP, design question -

java - Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? -