diff options
author | Xavier Noria <fxn@hashref.com> | 2016-09-01 23:41:49 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2016-09-01 23:41:49 +0200 |
commit | bb1ecdcc677bf6e68e0252505509c089619b5b90 (patch) | |
tree | 99dd8fd164e1c582216a4b08c3d066049217bb7f /activerecord/lib/active_record | |
parent | 8c402ef425771c3dbb4659dd946714e69fdf5ce9 (diff) | |
download | rails-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')
6 files changed, 9 insertions, 9 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) diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index 45d782e45e..0bd5ec4b26 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -970,8 +970,8 @@ module ActiveRecord end def foreign_key_for!(from_table, options_or_to_table = {}) # :nodoc: - foreign_key_for(from_table, options_or_to_table) or \ - raise ArgumentError, "Table '#{from_table}' has no foreign key for #{options_or_to_table}" + foreign_key_for(from_table, options_or_to_table) || \ + raise(ArgumentError, "Table '#{from_table}' has no foreign key for #{options_or_to_table}") end def foreign_key_column_for(table_name) # :nodoc: diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb index 696f2cd703..6f5d46b406 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb @@ -360,7 +360,7 @@ module ActiveRecord # Resets the sequence of a table's primary key to the maximum value. def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc: - unless pk and sequence + unless pk && sequence default_pk, default_sequence = pk_and_sequence_for(table) pk ||= default_pk @@ -403,7 +403,7 @@ module ActiveRecord AND dep.refobjid = '#{quote_table_name(table)}'::regclass end_sql - if result.nil? or result.empty? + if result.nil? || result.empty? result = query(<<-end_sql, "SCHEMA")[0] SELECT attr.attname, nsp.nspname, CASE diff --git a/activerecord/lib/active_record/connection_handling.rb b/activerecord/lib/active_record/connection_handling.rb index b4cd6cdd38..2ede92feff 100644 --- a/activerecord/lib/active_record/connection_handling.rb +++ b/activerecord/lib/active_record/connection_handling.rb @@ -109,7 +109,7 @@ module ActiveRecord end def connection_pool - connection_handler.retrieve_connection_pool(connection_specification_name) or raise ConnectionNotEstablished + connection_handler.retrieve_connection_pool(connection_specification_name) || raise(ConnectionNotEstablished) end def retrieve_connection diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 4628d7fb16..3465b68ac6 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -229,7 +229,7 @@ module ActiveRecord end def find_by!(*args) # :nodoc: - find_by(*args) or raise RecordNotFound.new("Couldn't find #{name}", name) + find_by(*args) || raise(RecordNotFound.new("Couldn't find #{name}", name)) end def initialize_generated_modules # :nodoc: |