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/fixtures.rb | |
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/fixtures.rb')
-rw-r--r-- | activerecord/lib/active_record/fixtures.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index d40bea5ea7..f3d3cdc9e3 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -656,7 +656,7 @@ module ActiveRecord fk_name = (association.options[:foreign_key] || "#{association.name}_id").to_s if association.name.to_s != fk_name && value = row.delete(association.name.to_s) - if association.options[:polymorphic] && value.sub!(/\s*\(([^\)]*)\)\s*$/, "") + if association.polymorphic? && value.sub!(/\s*\(([^\)]*)\)\s*$/, "") # support polymorphic belongs_to as "label (Type)" row[association.foreign_type] = $1 end |