aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/reflection.rb
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2014-06-01 09:30:40 -0400
committereileencodes <eileencodes@gmail.com>2014-06-09 19:27:08 -0400
commitbfd0159413ac7941c80166b41856795d93158bb1 (patch)
treedabee54d5ac2646f69309e12b856b9c378662503 /activerecord/lib/active_record/reflection.rb
parente1175d99e2c2813b248475fd0234818cd3b3e386 (diff)
downloadrails-bfd0159413ac7941c80166b41856795d93158bb1.tar.gz
rails-bfd0159413ac7941c80166b41856795d93158bb1.tar.bz2
rails-bfd0159413ac7941c80166b41856795d93158bb1.zip
reuse available collection? check instead of macro
Reflection has an available method that is used to check if the reflection is a collection. Any :has_many macro is considered a collection and `collection?` should be used instead of `macro == :has_many`.
Diffstat (limited to 'activerecord/lib/active_record/reflection.rb')
-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 43860791ce..d6686151be 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -392,7 +392,7 @@ Joining, Preloading and eager loading of these associations is deprecated and wi
# * you use autosave; <tt>autosave: true</tt>
# * the association is a +has_many+ association
def validate?
- !options[:validate].nil? ? options[:validate] : (options[:autosave] == true || macro == :has_many)
+ !options[:validate].nil? ? options[:validate] : (options[:autosave] == true || collection?)
end
# Returns +true+ if +self+ is a +belongs_to+ reflection.