diff options
author | wangjohn <wangjohn@mit.edu> | 2013-08-14 21:50:49 -0700 |
---|---|---|
committer | wangjohn <wangjohn@mit.edu> | 2013-08-15 02:44:02 -0400 |
commit | c9e2fa22cbf74f8184e502e7726fcfbe33bdb3e6 (patch) | |
tree | 167b7ecc14900b0ec78414e2e5bc53cc42acd874 /activerecord/lib | |
parent | e6b9f130a658977e3f9ddce106d321b55af916b7 (diff) | |
download | rails-c9e2fa22cbf74f8184e502e7726fcfbe33bdb3e6.tar.gz rails-c9e2fa22cbf74f8184e502e7726fcfbe33bdb3e6.tar.bz2 rails-c9e2fa22cbf74f8184e502e7726fcfbe33bdb3e6.zip |
Fixing multi-word automatic inverse detection.
Currently, ActiveRecord models with multiple words cannot have their
inverse associations detected automatically.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 73d154e03e..f428f160cf 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -394,7 +394,7 @@ module ActiveRecord # returns either nil or the inverse association name that it finds. def automatic_inverse_of if can_find_inverse_of_automatically?(self) - inverse_name = active_record.name.downcase.to_sym + inverse_name = ActiveSupport::Inflector.underscore(active_record.name).to_sym begin reflection = klass.reflect_on_association(inverse_name) @@ -413,7 +413,7 @@ module ActiveRecord end # Checks if the inverse reflection that is returned from the - # +set_automatic_inverse_of+ method is a valid reflection. We must + # +automatic_inverse_of+ method is a valid reflection. We must # make sure that the reflection's active_record name matches up # with the current reflection's klass name. # |