activerecord - Ruby on Rails: Fetch database result and search through results -
i have set of ids table called "brands". want fetch name column each record in brand table without having re-query database using brand.find(brand_id). instead, there way store database results variable , query variable?
thanks.
if collected records in var @brands, can use
name = @brands.find {|b| b.id == brand_id}.name not query
Comments
Post a Comment