aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorDmitry Polushkin <dmitry.polushkin@gmail.com>2013-05-12 22:19:19 +0100
committerDmitry Polushkin <dmitry.polushkin@gmail.com>2013-10-13 21:51:40 +0100
commit3a6cf83b9a0d9481d9bfa87afea2155e524e0596 (patch)
tree0a2d5b81eecb4c49304bca4de96367e330fd0e45 /activerecord/lib
parent05b178085a2ad3bf3f2c0dcd1ea40fb5e8c8dc0d (diff)
downloadrails-3a6cf83b9a0d9481d9bfa87afea2155e524e0596.tar.gz
rails-3a6cf83b9a0d9481d9bfa87afea2155e524e0596.tar.bz2
rails-3a6cf83b9a0d9481d9bfa87afea2155e524e0596.zip
add inversed accessor to association class
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/association.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb
index 2f33ecb71f..e6a45487d0 100644
--- a/activerecord/lib/active_record/associations/association.rb
+++ b/activerecord/lib/active_record/associations/association.rb
@@ -17,6 +17,7 @@ module ActiveRecord
# HasManyThroughAssociation + ThroughAssociation
class Association #:nodoc:
attr_reader :owner, :target, :reflection
+ attr_accessor :inversed
delegate :options, :to => :reflection
@@ -72,7 +73,7 @@ module ActiveRecord
#
# Note that if the target has not been loaded, it is not considered stale.
def stale_target?
- !@inversed && loaded? && @stale_state != stale_state
+ !inversed && loaded? && @stale_state != stale_state
end
# Sets the target of this association to <tt>\target</tt>, and the \loaded flag to +true+.
@@ -106,7 +107,7 @@ module ActiveRecord
if record && invertible_for?(record)
inverse = record.association(inverse_reflection_for(record).name)
inverse.target = owner
- inverse.instance_variable_set(:@inversed, true)
+ inverse.inversed = true
end
end