1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/lib/active_record/relation
Jon Leighton c86a32d745 CollectionProxy < Relation
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.
2012-05-11 20:11:04 +01:00
..
batches.rb
calculations.rb Lowercase. 2012-05-01 16:38:35 +02:00
delegation.rb
finder_methods.rb Return false for exists? with new records - fixes #6199. 2012-05-10 23:16:40 +01:00
merger.rb fix interpolation for hash merging 2012-04-25 15:45:06 +01:00
predicate_builder.rb CollectionProxy < Relation 2012-05-11 20:11:04 +01:00
query_methods.rb CollectionProxy < Relation 2012-05-11 20:11:04 +01:00
spawn_methods.rb CollectionProxy < Relation 2012-05-11 20:11:04 +01:00