mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
c86a32d745
This helps bring the interfaces of CollectionProxy and Relation closer together, and reduces the delegation backflips we need to perform. For example, first_or_create is defined thus: class ActiveRecord::Relation def first_or_create(...) first || create(...) end end If CollectionProxy < Relation, then post.comments.first_or_create will hit the association's #create method which will actually add the new record to the association, just as post.comments.create would. With the previous delegation, post.comments.first_or_create expands to post.comments.scoped.first_or_create, where post.comments.scoped has no knowledge of the association. |
||
---|---|---|
.. | ||
batches.rb | ||
calculations.rb | ||
delegation.rb | ||
finder_methods.rb | ||
merger.rb | ||
predicate_builder.rb | ||
query_methods.rb | ||
spawn_methods.rb |