I am trying to understand active record source code. The function includes
seems to be a class method. Tracing with byebug
I found the roots in lib/active_record/relation/query_methods.rb:137
like this
def includes(*args)
check_if_method_has_arguments!(:includes, args)
spawn.includes!(*args)
end
This is an instance method and not a class method. But, let's say for a model named User
we can do:
User.includes(:images)
How does it work in a class context?