diff options
Diffstat (limited to 'activerecord/lib/active_record/association_relation.rb')
-rw-r--r-- | activerecord/lib/active_record/association_relation.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/association_relation.rb b/activerecord/lib/active_record/association_relation.rb new file mode 100644 index 0000000000..5a84792f45 --- /dev/null +++ b/activerecord/lib/active_record/association_relation.rb @@ -0,0 +1,22 @@ +module ActiveRecord + class AssociationRelation < Relation + def initialize(klass, table, association) + super(klass, table) + @association = association + end + + def proxy_association + @association + end + + def ==(other) + other == to_a + end + + private + + def exec_queries + super.each { |r| @association.set_inverse_instance r } + end + end +end |