method
take
v5.0.0.1 -
Show latest stable
- Class:
ActiveRecord::Associations::CollectionAssociation
take(n = nil)public
No documentation available.
# File activerecord/lib/active_record/associations/collection_association.rb, line 151
def take(n = nil)
if loaded?
n ? target.take(n) : target.first
else
scope.take(n).tap do |record|
set_inverse_instance record if record.is_a? ActiveRecord::Base
end
end
end