instance method
load
Ruby on Rails 5.2.8.1
Since v4.0.13Signature
load(&block)
Causes the records to be loaded from the database if they have not been loaded already. You can use this if for some reason you need to explicitly load some records before actually using them. The return value is the relation itself, not the records.
Post.where(published: true).load # => #<ActiveRecord::Relation>
Parameters
-
blockblock
Source
# File activerecord/lib/active_record/relation.rb, line 421
def load(&block)
exec_queries(&block) unless loaded?
self
end
Defined in activerecord/lib/active_record/relation.rb line 421
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Relation