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

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -