diff options
author | eileencodes <eileencodes@gmail.com> | 2014-06-02 14:14:08 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2014-06-02 23:01:59 -0400 |
commit | 46acd8b86da6886560cba20f29515215ec8b9c38 (patch) | |
tree | dc8948489990738deb2c28e911e6db9e4f342ec5 /activerecord/lib/active_record/associations | |
parent | e2a97adbae6c90b1a749d28ed9aae1f83ec524e9 (diff) | |
download | rails-46acd8b86da6886560cba20f29515215ec8b9c38.tar.gz rails-46acd8b86da6886560cba20f29515215ec8b9c38.tar.bz2 rails-46acd8b86da6886560cba20f29515215ec8b9c38.zip |
fix polymorphic? method and reuse it
Fix polymorphic to check for `options[:polymorphic]` instead of
`options.key? :polymorphic` and then reuse the method `polymorphic?`
method instead of constantly checking the same `options[:polymorphic]`.
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/association_scope.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb index 572f556999..31108cc1aa 100644 --- a/activerecord/lib/active_record/associations/association_scope.rb +++ b/activerecord/lib/active_record/associations/association_scope.rb @@ -106,7 +106,7 @@ module ActiveRecord table, foreign_table = tables.shift, tables.first if reflection.source_macro == :belongs_to - if reflection.options[:polymorphic] + if reflection.polymorphic? key = reflection.association_primary_key(assoc_klass) else key = reflection.association_primary_key diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index 01173b68f3..35659766d3 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -217,7 +217,7 @@ module ActiveRecord reflection.check_validity! reflection.check_eager_loadable! - if reflection.options[:polymorphic] + if reflection.polymorphic? raise EagerLoadPolymorphicError.new(reflection) end |