From bb1ecdcc677bf6e68e0252505509c089619b5b90 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Thu, 1 Sep 2016 23:41:49 +0200 Subject: fixes remaining RuboCop issues [Vipul A M, Xavier Noria] --- activerecord/lib/active_record/associations/has_many_association.rb | 2 +- activerecord/lib/active_record/associations/join_dependency.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record/associations') 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) -- cgit v1.2.3