diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index d84320b7131daf0c566ceeb466b067b248a720e0..16ddd3b304cdf144bc93b58d4cde3e18cf1a6e3c 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -663,14 +663,14 @@ def kwarg_request?(args) def non_kwarg_request_warning ActiveSupport::Deprecation.warn(<<-MSG.strip_heredoc) - ActionController::TestCase HTTP request methods will accept only - keyword arguments in future Rails versions. + ActionController::TestCase HTTP request methods will accept only + keyword arguments in future Rails versions. - Examples: + Examples: - get :show, params: { id: 1 }, session: { user_id: 1 } - process :update, method: :post, params: { id: 1 } - MSG + get :show, params: { id: 1 }, session: { user_id: 1 } + process :update, method: :post, params: { id: 1 } + MSG end def document_root_element diff --git a/actionpack/lib/action_dispatch/journey/nfa/dot.rb b/actionpack/lib/action_dispatch/journey/nfa/dot.rb index 0cd71b726aaaf0cb9ae079499d850fb6d827c69a..8119e5d9dac86c493f256cfb8de8edbba674e449 100644 --- a/actionpack/lib/action_dispatch/journey/nfa/dot.rb +++ b/actionpack/lib/action_dispatch/journey/nfa/dot.rb @@ -26,7 +26,7 @@ def to_dot node [shape = circle]; #{edges.join "\n"} } - eodot + eodot end end end diff --git a/actionpack/lib/action_dispatch/middleware/stack.rb b/actionpack/lib/action_dispatch/middleware/stack.rb index e49bf5411527815435424469f5a4440b2336a88b..466eb8b3f1cad3fbebf7d8351075bab9662329ee 100644 --- a/actionpack/lib/action_dispatch/middleware/stack.rb +++ b/actionpack/lib/action_dispatch/middleware/stack.rb @@ -119,7 +119,7 @@ def get_class(klass) "#{klass}" => #{converted_klass} - eowarn + eowarn converted_klass else klass diff --git a/actionview/lib/action_view/layouts.rb b/actionview/lib/action_view/layouts.rb index b6bf6b9374d8265cdbd197481e071346d5c0d22c..dd5f6e730060820d327e2f36d43c993713970822 100644 --- a/actionview/lib/action_view/layouts.rb +++ b/actionview/lib/action_view/layouts.rb @@ -290,11 +290,12 @@ def _write_layout_method # :nodoc: RUBY end - layout_definition = case _layout - when String - _layout.inspect - when Symbol - <<-RUBY + layout_definition = \ + case _layout + when String + _layout.inspect + when Symbol + <<-RUBY #{_layout}.tap do |layout| return #{default_behavior} if layout.nil? unless layout.is_a?(String) || !layout @@ -303,21 +304,21 @@ def _write_layout_method # :nodoc: end end RUBY - when Proc - define_method :_layout_from_proc, &_layout - protected :_layout_from_proc - <<-RUBY + when Proc + define_method :_layout_from_proc, &_layout + protected :_layout_from_proc + <<-RUBY result = _layout_from_proc(#{_layout.arity == 0 ? '' : 'self'}) return #{default_behavior} if result.nil? result RUBY - when false - nil - when true - raise ArgumentError, "Layouts must be specified as a String, Symbol, Proc, false, or nil" - when nil - name_clause - end + when false + nil + when true + raise ArgumentError, "Layouts must be specified as a String, Symbol, Proc, false, or nil" + when nil + name_clause + end self.class_eval <<-RUBY, __FILE__, __LINE__ + 1 def _layout(formats) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 7759b0a044b65b2e6a55b6d03a9997942ad4542a..dc6fe1640e62eae8c902fa7e368670b6fd9f7be0 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1810,12 +1810,12 @@ def has_and_belongs_to_many(name, scope = nil, **options, &extension) include Module.new { class_eval <<-RUBY, __FILE__, __LINE__ + 1 - def destroy_associations - association(:#{middle_reflection.name}).delete_all(:delete_all) - association(:#{name}).reset - super - end - RUBY + def destroy_associations + association(:#{middle_reflection.name}).delete_all(:delete_all) + association(:#{name}).reset + super + end + RUBY } hm_options = {} diff --git a/activerecord/lib/active_record/attribute_methods/primary_key.rb b/activerecord/lib/active_record/attribute_methods/primary_key.rb index 9e99ed8ac1e8362c7a7d15be128ffa40bd3d1494..6243398a528c75a04ee989fd4201e435429e1b99 100644 --- a/activerecord/lib/active_record/attribute_methods/primary_key.rb +++ b/activerecord/lib/active_record/attribute_methods/primary_key.rb @@ -130,10 +130,10 @@ def suppress_composite_primary_key(pk) return pk unless pk.is_a?(Array) warn <<-WARNING.strip_heredoc - WARNING: Active Record does not support composite primary key. + WARNING: Active Record does not support composite primary key. - #{table_name} has composite primary key. Composite primary key is ignored. - WARNING + #{table_name} has composite primary key. Composite primary key is ignored. + WARNING end end end diff --git a/activerecord/lib/active_record/attribute_methods/read.rb b/activerecord/lib/active_record/attribute_methods/read.rb index 58f82cfd300f7ac9e0553f07f92c469b509ee883..131ed8740b9f030899a254cc068794d1f51fa20c 100644 --- a/activerecord/lib/active_record/attribute_methods/read.rb +++ b/activerecord/lib/active_record/attribute_methods/read.rb @@ -31,11 +31,11 @@ def define_method_attribute(name) ActiveRecord::AttributeMethods::AttrNames.set_name_cache safe_name, name generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1 - def #{temp_method} - name = ::ActiveRecord::AttributeMethods::AttrNames::ATTR_#{safe_name} - _read_attribute(name) { |n| missing_attribute(n, caller) } - end - STR + def #{temp_method} + name = ::ActiveRecord::AttributeMethods::AttrNames::ATTR_#{safe_name} + _read_attribute(name) { |n| missing_attribute(n, caller) } + end + STR generated_attribute_methods.module_eval do alias_method name, temp_method diff --git a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb index 2c8e86fbb249074277176c00c7e902b43491d08f..bea1514cdfbfb883afbc63cb7b5d75ff4aa70cbc 100644 --- a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb +++ b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb @@ -94,18 +94,18 @@ def create_time_zone_conversion_attribute?(name, cast_type) cast_type.type == :time && time_zone_aware_types.include?(:not_explicitly_configured) ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc) - Time columns will become time zone aware in Rails 5.1. This - still causes `String`s to be parsed as if they were in `Time.zone`, - and `Time`s to be converted to `Time.zone`. + Time columns will become time zone aware in Rails 5.1. This + still causes `String`s to be parsed as if they were in `Time.zone`, + and `Time`s to be converted to `Time.zone`. - To keep the old behavior, you must add the following to your initializer: + To keep the old behavior, you must add the following to your initializer: - config.active_record.time_zone_aware_types = [:datetime] + config.active_record.time_zone_aware_types = [:datetime] - To silence this deprecation warning, add the following: + To silence this deprecation warning, add the following: - config.active_record.time_zone_aware_types = [:datetime, :time] - MESSAGE + config.active_record.time_zone_aware_types = [:datetime, :time] + MESSAGE end result diff --git a/activerecord/lib/active_record/attribute_methods/write.rb b/activerecord/lib/active_record/attribute_methods/write.rb index 5822414129ad7161f778f90f6c4d44ff75de04f1..e9d044ef137ecaa4f5c8715bd374e6b0a010276f 100644 --- a/activerecord/lib/active_record/attribute_methods/write.rb +++ b/activerecord/lib/active_record/attribute_methods/write.rb @@ -15,13 +15,13 @@ def define_method_attribute=(name) ActiveRecord::AttributeMethods::AttrNames.set_name_cache safe_name, name generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1 - def __temp__#{safe_name}=(value) - name = ::ActiveRecord::AttributeMethods::AttrNames::ATTR_#{safe_name} - write_attribute(name, value) - end - alias_method #{(name + '=').inspect}, :__temp__#{safe_name}= - undef_method :__temp__#{safe_name}= - STR + def __temp__#{safe_name}=(value) + name = ::ActiveRecord::AttributeMethods::AttrNames::ATTR_#{safe_name} + write_attribute(name, value) + end + alias_method #{(name + '=').inspect}, :__temp__#{safe_name}= + undef_method :__temp__#{safe_name}= + STR end end diff --git a/activerecord/lib/active_record/dynamic_matchers.rb b/activerecord/lib/active_record/dynamic_matchers.rb index 55490e27bc2eeccf44ae0be38cca97f02d1580b7..bbd8ca23771bbb87a0c1ed7037a09c2f1c489d03 100644 --- a/activerecord/lib/active_record/dynamic_matchers.rb +++ b/activerecord/lib/active_record/dynamic_matchers.rb @@ -63,10 +63,10 @@ def valid? def define model.class_eval <<-CODE, __FILE__, __LINE__ + 1 - def self.#{name}(#{signature}) - #{body} - end - CODE + def self.#{name}(#{signature}) + #{body} + end + CODE end private diff --git a/activerecord/lib/active_record/migration/command_recorder.rb b/activerecord/lib/active_record/migration/command_recorder.rb index 7e60aabc2d5b0bbe8518887a3fc6b26c82ce2050..44ea756028068d3da1e7593df2faeae85a3607c6 100644 --- a/activerecord/lib/active_record/migration/command_recorder.rb +++ b/activerecord/lib/active_record/migration/command_recorder.rb @@ -125,10 +125,10 @@ module StraightReversions }.each do |cmd, inv| [[inv, cmd], [cmd, inv]].uniq.each do |method, inverse| class_eval <<-EOV, __FILE__, __LINE__ + 1 - def invert_#{method}(args, &block) # def invert_create_table(args, &block) - [:#{inverse}, args, block] # [:drop_table, args, block] - end # end - EOV + def invert_#{method}(args, &block) # def invert_create_table(args, &block) + [:#{inverse}, args, block] # [:drop_table, args, block] + end # end + EOV end end end diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index 86f8cb5d26db59ea0ef7123fe3a531ead938c489..14af64c104b989b895d236105ef606714baf7ae2 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -354,13 +354,13 @@ def accepts_nested_attributes_for(*attr_names) # associations are just regular associations. def generate_association_writer(association_name, type) generated_association_methods.module_eval <<-eoruby, __FILE__, __LINE__ + 1 - if method_defined?(:#{association_name}_attributes=) - remove_method(:#{association_name}_attributes=) - end - def #{association_name}_attributes=(attributes) - assign_nested_attributes_for_#{type}_association(:#{association_name}, attributes) - end - eoruby + if method_defined?(:#{association_name}_attributes=) + remove_method(:#{association_name}_attributes=) + end + def #{association_name}_attributes=(attributes) + assign_nested_attributes_for_#{type}_association(:#{association_name}, attributes) + end + eoruby end end diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 376867675b33edd1aed9848542b152e2db9efd98..5e580ac86582cf6147309b54229d35ec82eb90eb 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -466,9 +466,9 @@ def find_one(id) if ActiveRecord::Base === id id = id.id ActiveSupport::Deprecation.warn(<<-MSG.squish) - You are passing an instance of ActiveRecord::Base to `find`. - Please pass the id of the object by calling `.id`. - MSG + You are passing an instance of ActiveRecord::Base to `find`. + Please pass the id of the object by calling `.id`. + MSG end relation = where(primary_key => id) diff --git a/activerecord/lib/active_record/relation/predicate_builder/class_handler.rb b/activerecord/lib/active_record/relation/predicate_builder/class_handler.rb index 73ad86476528624572f3e7d5aee096fa40ff6700..0a6574fcf1426315a981e492160e81a9a7c0aaf4 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/class_handler.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/class_handler.rb @@ -18,9 +18,9 @@ def call(attribute, value) def print_deprecation_warning ActiveSupport::Deprecation.warn(<<-MSG.squish) - Passing a class as a value in an Active Record query is deprecated and - will be removed. Pass a string instead. - MSG + Passing a class as a value in an Active Record query is deprecated and + will be removed. Pass a string instead. + MSG end end end diff --git a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb index c8b89f1fdf304afab2dba4af4196a476f91be4c1..3a5e0b8dfe7f8d37aae382ebad6f63fae5b69933 100644 --- a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb @@ -105,7 +105,7 @@ def grant_statement GRANT ALL PRIVILEGES ON #{configuration['database']}.* TO '#{configuration['username']}'@'localhost' IDENTIFIED BY '#{configuration['password']}' WITH GRANT OPTION; - SQL + SQL end def root_configuration_without_database diff --git a/activerecord/test/cases/adapters/postgresql/rename_table_test.rb b/activerecord/test/cases/adapters/postgresql/rename_table_test.rb index 461353d239545707e50fecbf5241fc0482eb1fb9..e9e7f717ac5bcda751bbda470a7225633f0a46c9 100644 --- a/activerecord/test/cases/adapters/postgresql/rename_table_test.rb +++ b/activerecord/test/cases/adapters/postgresql/rename_table_test.rb @@ -26,9 +26,9 @@ def teardown def num_indices_named(name) @connection.execute(<<-SQL).values.length - SELECT 1 FROM "pg_index" - JOIN "pg_class" ON "pg_index"."indexrelid" = "pg_class"."oid" - WHERE "pg_class"."relname" = '#{name}' - SQL + SELECT 1 FROM "pg_index" + JOIN "pg_class" ON "pg_index"."indexrelid" = "pg_class"."oid" + WHERE "pg_class"."relname" = '#{name}' + SQL end end diff --git a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb index d2f0710cb2f16da4130f3ad5800a9312f2240082..66f93491111372feb2a330ecaaffd2d470549033 100644 --- a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb @@ -431,9 +431,9 @@ def assert_logged(logs) def with_example_table(definition = nil, table_name = "ex", &block) definition ||= <<-SQL - id integer PRIMARY KEY AUTOINCREMENT, - number integer - SQL + id integer PRIMARY KEY AUTOINCREMENT, + number integer + SQL super(@conn, table_name, definition, &block) end end diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index 7a2041937df0035ccd6b7161e5440b7f3d275e9f..993d9f8b9437924506faa25edca4998a466e6590 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -1003,10 +1003,10 @@ def time_related_columns_on_topic def privatize(method_signature) @target.class_eval(<<-private_method, __FILE__, __LINE__ + 1) - private - def #{method_signature} - "I'm private" - end - private_method + private + def #{method_signature} + "I'm private" + end + private_method end end diff --git a/activerecord/test/cases/relation_test.rb b/activerecord/test/cases/relation_test.rb index 32b8781a6b6875b84d9b5097883e35a0fada99ba..23d27ab90a0848cf6eec6f9618965c125d6d7002 100644 --- a/activerecord/test/cases/relation_test.rb +++ b/activerecord/test/cases/relation_test.rb @@ -310,10 +310,10 @@ def test_update_all_goes_through_normal_type_casting def skip_if_sqlite3_version_includes_quoting_bug if sqlite3_version_includes_quoting_bug? skip <<-ERROR.squish - You are using an outdated version of SQLite3 which has a bug in - quoted column names. Please update SQLite3 and rebuild the sqlite3 - ruby gem - ERROR + You are using an outdated version of SQLite3 which has a bug in + quoted column names. Please update SQLite3 and rebuild the sqlite3 + ruby gem + ERROR end end diff --git a/activerecord/test/cases/view_test.rb b/activerecord/test/cases/view_test.rb index aa3ff6160c51544e7aa6d77993146f8f86046b4e..3cbfbc22c6ff12326e2050e6667adbc7d80d1616 100644 --- a/activerecord/test/cases/view_test.rb +++ b/activerecord/test/cases/view_test.rb @@ -100,9 +100,9 @@ class Paperback < ActiveRecord::Base; end setup do @connection = ActiveRecord::Base.connection @connection.execute <<-SQL - CREATE VIEW paperbacks - AS SELECT name, status FROM books WHERE format = 'paperback' - SQL + CREATE VIEW paperbacks + AS SELECT name, status FROM books WHERE format = 'paperback' + SQL end teardown do @@ -162,9 +162,9 @@ class PrintedBook < ActiveRecord::Base setup do @connection = ActiveRecord::Base.connection @connection.execute <<-SQL - CREATE VIEW printed_books - AS SELECT id, name, status, format FROM books WHERE format = 'paperback' - SQL + CREATE VIEW printed_books + AS SELECT id, name, status, format FROM books WHERE format = 'paperback' + SQL end teardown do diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index a33cab050436d9e3d4d8dc2e027cace0b7e0fc3a..ecf0c0eec7dddcf781b372bd8659cf01b2582b00 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -297,9 +297,9 @@ class Callback #:nodoc:# def self.build(chain, filter, kind, options) if filter.is_a?(String) ActiveSupport::Deprecation.warn(<<-MSG.squish) - Passing string to define callback is deprecated and will be removed - in Rails 5.1 without replacement. - MSG + Passing string to define callback is deprecated and will be removed + in Rails 5.1 without replacement. + MSG end new chain.name, filter, kind, options, chain.config @@ -751,10 +751,10 @@ def define_callbacks(*names) set_callbacks name, CallbackChain.new(name, options) module_eval <<-RUBY, __FILE__, __LINE__ + 1 - def _run_#{name}_callbacks(&block) - __run_callbacks__(_#{name}_callbacks, &block) - end - RUBY + def _run_#{name}_callbacks(&block) + __run_callbacks__(_#{name}_callbacks, &block) + end + RUBY end end @@ -787,9 +787,9 @@ def deprecated_false_terminator # :nodoc: def display_deprecation_warning_for_false_terminator ActiveSupport::Deprecation.warn(<<-MSG.squish) - Returning `false` in Active Record and Active Model callbacks will not implicitly halt a callback chain in Rails 5.1. - To explicitly halt the callback chain, please use `throw :abort` instead. - MSG + Returning `false` in Active Record and Active Model callbacks will not implicitly halt a callback chain in Rails 5.1. + To explicitly halt the callback chain, please use `throw :abort` instead. + MSG end end end