aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/fixtures.rb
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2014-06-02 14:14:08 -0400
committereileencodes <eileencodes@gmail.com>2014-06-02 23:01:59 -0400
commit46acd8b86da6886560cba20f29515215ec8b9c38 (patch)
treedc8948489990738deb2c28e911e6db9e4f342ec5 /activerecord/lib/active_record/fixtures.rb
parente2a97adbae6c90b1a749d28ed9aae1f83ec524e9 (diff)
downloadrails-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.rb2
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