e.g. I have two models:
class Currency < ActiveRecord::Base
class ProductPrice < ActiveRecord::Base
currencies table has 2 records:
when I run:
prices = ProductPrice.find(:al)
I get array of ProductPrice instances where each object has currency
attr. RoR makes the query ‘select * from currencies where id=NNN’ for
each instance. So I have scores of equal queries.
Is an ability to avoid permanent “get” from db ? Can RoR cache all
records from currencies (any given) table and then use them?
Sure, I can store all curencies table’s records to array and manually
use them (without build-in RoR relationships) but I think I lose some
prices = ProductPrice.find(:all, :include => [:currency]) not works in