aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-09-01 23:41:49 +0200
committerXavier Noria <fxn@hashref.com>2016-09-01 23:41:49 +0200
commitbb1ecdcc677bf6e68e0252505509c089619b5b90 (patch)
tree99dd8fd164e1c582216a4b08c3d066049217bb7f /activerecord/lib/active_record/associations
parent8c402ef425771c3dbb4659dd946714e69fdf5ce9 (diff)
downloadrails-bb1ecdcc677bf6e68e0252505509c089619b5b90.tar.gz
rails-bb1ecdcc677bf6e68e0252505509c089619b5b90.tar.bz2
rails-bb1ecdcc677bf6e68e0252505509c089619b5b90.zip
fixes remaining RuboCop issues [Vipul A M, Xavier Noria]
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/has_many_association.rb2
-rw-r--r--activerecord/lib/active_record/associations/join_dependency.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb
index 6720578b2c..d1d0cc4c49 100644
--- a/activerecord/lib/active_record/associations/has_many_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_association.rb
@@ -80,7 +80,7 @@ module ActiveRecord
# If there's nothing in the database and @target has no new records
# we are certain the current target is an empty array. This is a
# documented side-effect of the method that may avoid an extra SELECT.
- @target ||= [] and loaded! if count == 0
+ (@target ||= []) && loaded! if count == 0
[association_scope.limit_value, count].compact.min
end
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb
index 02f0721bed..c26c469c1e 100644
--- a/activerecord/lib/active_record/associations/join_dependency.rb
+++ b/activerecord/lib/active_record/associations/join_dependency.rb
@@ -228,8 +228,8 @@ module ActiveRecord
end
def find_reflection(klass, name)
- klass._reflect_on_association(name) or
- raise ConfigurationError, "Can't join '#{ klass.name }' to association named '#{ name }'; perhaps you misspelled it?"
+ klass._reflect_on_association(name) ||
+ raise(ConfigurationError, "Can't join '#{klass.name}' to association named '#{name}'; perhaps you misspelled it?")
end
def build(associations, base_klass)