aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorAndrew S. Brown <andrew@dontfidget.com>2014-05-26 11:52:46 -0700
committerAndrew S. Brown <andrew@dontfidget.com>2014-06-10 21:46:12 -0700
commit9feadc11a71b655dd7748c0f3a92bc411c9e63c2 (patch)
treef092bdda0e4ff4fd375557e2afe3a2169e121a79 /activerecord/lib/active_record
parentd075c84320fab51992a1ab7d020c62ff1bad0b4e (diff)
downloadrails-9feadc11a71b655dd7748c0f3a92bc411c9e63c2.tar.gz
rails-9feadc11a71b655dd7748c0f3a92bc411c9e63c2.tar.bz2
rails-9feadc11a71b655dd7748c0f3a92bc411c9e63c2.zip
use name specified by 'as' for automatic inverse association to avoid reflecting on wrong association
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/reflection.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index 0eec6774a0..5a445eb892 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -433,7 +433,7 @@ Joining, Preloading and eager loading of these associations is deprecated and wi
# returns either nil or the inverse association name that it finds.
def automatic_inverse_of
if can_find_inverse_of_automatically?(self)
- inverse_name = ActiveSupport::Inflector.underscore(active_record.name).to_sym
+ inverse_name = ActiveSupport::Inflector.underscore(options[:as] || active_record.name).to_sym
begin
reflection = klass.reflect_on_association(inverse_name)