Method: ActiveRecord::QueryMethods#preload

Defined in:
lib/active_record/relation/query_methods.rb

#preload(*args) ⇒ Object

Allows preloading of args, in the same way that includes does:

User.preload(:posts)
=> SELECT "posts".* FROM "posts" WHERE "posts"."user_id" IN (1, 2, 3)


164
165
166
167
# File 'lib/active_record/relation/query_methods.rb', line 164

def preload(*args)
  check_if_method_has_arguments!(:preload, args)
  spawn.preload!(*args)
end