Rails Find a Record Within ActiveRecord::Relation Object without querying database again

Once the relation has been loaded, you can use regular array methods. find is actually a very interesting method here – if block is specified, it will be delegated to the relation target:

@blogs.find {|b| b.id == 1}

Leave a Comment