From dc47c2be4eb28a92e7fc0f2195b81ed453b8245d Mon Sep 17 00:00:00 2001 From: Fabian Schwahn Date: Thu, 20 Apr 2017 10:59:20 +0200 Subject: Remove :polymorphic from INVALID_AUTOMATIC_INVERSE_OPTIONS This makes automatic inverse detection possible for polymorphic :has_one & :has_many possible. This resolves a number of issues, eg. `touch: true` on polymorphic relationships (#16446) and automatically setting inverse associations on newly built objects (#15028, #21843). --- activerecord/lib/active_record/reflection.rb | 7 +++---- activerecord/test/cases/associations/inverse_associations_test.rb | 8 ++------ 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 24ca8b0be4..c7472372ab 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -567,7 +567,7 @@ module ActiveRecord end VALID_AUTOMATIC_INVERSE_MACROS = [:has_many, :has_one, :belongs_to] - INVALID_AUTOMATIC_INVERSE_OPTIONS = [:conditions, :through, :polymorphic, :foreign_key] + INVALID_AUTOMATIC_INVERSE_OPTIONS = [:conditions, :through, :foreign_key] def add_as_source(seed) seed @@ -640,9 +640,8 @@ module ActiveRecord # us from being able to guess the inverse automatically. First, the # inverse_of option cannot be set to false. Second, we must # have has_many, has_one, belongs_to associations. - # Third, we must not have options such as :polymorphic or - # :foreign_key which prevent us from correctly guessing the - # inverse association. + # Third, we must not have options such as :foreign_key + # which prevent us from correctly guessing the inverse association. # # Anything with a scope can additionally ruin our attempt at finding an # inverse, so we exclude reflections with scopes. diff --git a/activerecord/test/cases/associations/inverse_associations_test.rb b/activerecord/test/cases/associations/inverse_associations_test.rb index 287b3e9ebc..cf51f1009f 100644 --- a/activerecord/test/cases/associations/inverse_associations_test.rb +++ b/activerecord/test/cases/associations/inverse_associations_test.rb @@ -116,15 +116,11 @@ class AutomaticInverseFindingTests < ActiveRecord::TestCase assert !club_reflection.has_inverse?, "A has_many_through association should not find an inverse automatically" end - def test_polymorphic_relationships_should_still_not_have_inverses_when_non_polymorphic_relationship_has_the_same_name + def test_polymorphic_has_one_should_find_inverse_automatically man_reflection = Man.reflect_on_association(:polymorphic_face_without_inverse) - face_reflection = Face.reflect_on_association(:man) - - assert_respond_to face_reflection, :has_inverse? - assert face_reflection.has_inverse?, "For this test, the non-polymorphic association must have an inverse" assert_respond_to man_reflection, :has_inverse? - assert !man_reflection.has_inverse?, "The target of a polymorphic association should not find an inverse automatically" + assert man_reflection.has_inverse? end end -- cgit v1.2.3 From c2120582e4d27d2a64131820a46392af60f1e8b6 Mon Sep 17 00:00:00 2001 From: Fabian Schwahn Date: Thu, 20 Apr 2017 11:10:06 +0200 Subject: Add regression test for setting inverse instances on normal & polymorphic relationships when building objects on new records --- .../test/cases/associations/has_many_associations_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'activerecord') diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index e2f044c139..40a0bea91b 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -241,6 +241,13 @@ class HasManyAssociationsTest < ActiveRecord::TestCase assert_equal "defaulty", bulb.name end + def test_build_from_association_sets_inverse_instance + car = Car.new(name: "honda") + + bulb = car.bulbs.build + assert_equal car, bulb.car + end + def test_do_not_call_callbacks_for_delete_all car = Car.create(name: "honda") car.funky_bulbs.create! @@ -2146,6 +2153,13 @@ class HasManyAssociationsTest < ActiveRecord::TestCase assert_equal "Post", tagging.taggable_type end + def test_build_from_polymorphic_association_sets_inverse_instance + post = Post.new + tagging = post.taggings.build + + assert_equal post, tagging.taggable + end + def test_dont_call_save_callbacks_twice_on_has_many firm = companies(:first_firm) contract = firm.contracts.create! -- cgit v1.2.3 From b0e714bd02d86706abc55add70fb61f73973e362 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sat, 29 Apr 2017 22:53:40 +0900 Subject: Remove `HasAndBelongsToManyReflection#initialize` It is delegating `super` only. --- activerecord/lib/active_record/reflection.rb | 4 ---- 1 file changed, 4 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 24ca8b0be4..47b561840f 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -745,10 +745,6 @@ module ActiveRecord end class HasAndBelongsToManyReflection < AssociationReflection # :nodoc: - def initialize(name, scope, options, active_record) - super - end - def macro; :has_and_belongs_to_many; end def collection? -- cgit v1.2.3 From a44e62befd4fea60375f41ea129fd39a00cbf505 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 30 Apr 2017 01:41:32 +0900 Subject: Remove `method_missing` in `Relation::Delegation` The `method_missing` is never reached since 64c53d7c. --- activerecord/lib/active_record/relation/delegation.rb | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/relation/delegation.rb b/activerecord/lib/active_record/relation/delegation.rb index 257ae04ff4..d08475710e 100644 --- a/activerecord/lib/active_record/relation/delegation.rb +++ b/activerecord/lib/active_record/relation/delegation.rb @@ -115,15 +115,5 @@ module ActiveRecord def respond_to_missing?(method, _) super || @klass.respond_to?(method) || arel.respond_to?(method) end - - def method_missing(method, *args, &block) - if @klass.respond_to?(method) - scoping { @klass.public_send(method, *args, &block) } - elsif arel.respond_to?(method) - arel.public_send(method, *args, &block) - else - super - end - end end end -- cgit v1.2.3 From 41f6347c5b4923b71360ea19f860ef77f5c91d77 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 14 May 2017 08:37:37 +0900 Subject: Use `timestamp_attributes_for_update_in_model` rather than `timestamp_attributes_for_update` --- activerecord/lib/active_record/timestamp.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/timestamp.rb b/activerecord/lib/active_record/timestamp.rb index 09d8d1cdd4..a304b63d22 100644 --- a/activerecord/lib/active_record/timestamp.rb +++ b/activerecord/lib/active_record/timestamp.rb @@ -127,7 +127,7 @@ module ActiveRecord self.class.send(:current_time_from_proper_timezone) end - def max_updated_column_timestamp(timestamp_names = self.class.send(:timestamp_attributes_for_update)) + def max_updated_column_timestamp(timestamp_names = timestamp_attributes_for_update_in_model) timestamp_names .map { |attr| self[attr] } .compact -- cgit v1.2.3 From d807e3f59d93dd9f590af83e708d0a21f208094a Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 18 May 2017 10:52:16 +0900 Subject: Prevent extra `through_scope` We can reuse `through_scope` for `reset_association`. --- .../lib/active_record/associations/preloader/through_association.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/preloader/through_association.rb b/activerecord/lib/active_record/associations/preloader/through_association.rb index d53d3f777b..0749b038b6 100644 --- a/activerecord/lib/active_record/associations/preloader/through_association.rb +++ b/activerecord/lib/active_record/associations/preloader/through_association.rb @@ -11,6 +11,8 @@ module ActiveRecord end def associated_records_by_owner(preloader) + through_scope = through_scope() + preloader.preload(owners, through_reflection.name, through_scope) @@ -20,7 +22,7 @@ module ActiveRecord [owner, Array(center)] end - reset_association owners, through_reflection.name + reset_association(owners, through_reflection.name, through_scope) middle_records = through_records.flat_map(&:last) @@ -63,7 +65,7 @@ module ActiveRecord id_map end - def reset_association(owners, association_name) + def reset_association(owners, association_name, through_scope) should_reset = (through_scope != through_reflection.klass.unscoped) || (reflection.options[:source_type] && through_reflection.collection?) -- cgit v1.2.3 From 3ac5229f32433405628dbca0ec190f7df5013841 Mon Sep 17 00:00:00 2001 From: Nerian Date: Thu, 18 May 2017 18:55:50 +0200 Subject: Document support for composite primary keys --- .../connection_adapters/abstract/schema_statements.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'activerecord') 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 13629dee7f..6015c38ab5 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -188,6 +188,8 @@ module ActiveRecord # The name of the primary key, if one is to be added automatically. # Defaults to +id+. If :id is false, then this option is ignored. # + # If an array is passed, a composite primary key will created. + # # Note that Active Record models will automatically detect their # primary key. This can be avoided by using # {self.primary_key=}[rdoc-ref:AttributeMethods::PrimaryKey::ClassMethods#primary_key=] on the model @@ -241,6 +243,23 @@ module ActiveRecord # label varchar # ) # + # ====== Create a composite primary key + # + # create_table(:orders, primary_key: [:product_id, :client_id]) do |t| + # t.belongs_to :product + # t.belongs_to :client + # end + # + # generates: + # + # CREATE TABLE order ( + # product_id integer NOT NULL, + # client_id integer NOT NULL + # ); + # + # ALTER TABLE ONLY "orders" + # ADD CONSTRAINT orders_pkey PRIMARY KEY (product_id, client_id); + # # ====== Do not add a primary key column # # create_table(:categories_suppliers, id: false) do |t| -- cgit v1.2.3 From 67a4a9feb9d31747db8a9ce5fcfe61d6067dd625 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 11 May 2017 04:20:53 +0900 Subject: Prevent making bind param if casted value is nil If casted value is nil, generated SQL should be `IS NULL`. But currently it is generated as `= NULL`. To prevent this behavior, avoid making bind param if casted value is nil. Fixes #28945. --- activerecord/CHANGELOG.md | 4 ++++ .../lib/active_record/relation/predicate_builder.rb | 19 ++++++++++++------- .../active_record/relation/where_clause_factory.rb | 2 +- activerecord/test/cases/enum_test.rb | 2 ++ activerecord/test/cases/relation/where_test.rb | 6 +++++- 5 files changed, 24 insertions(+), 9 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 1f8163db12..f75f1a9108 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,7 @@ +* Prevent making bind param if casted value is nil. + + *Ryuta Kamizono* + * Deprecate passing arguments and block at the same time to `count` and `sum` in `ActiveRecord::Calculations`. *Ryuta Kamizono* diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index a6309e0b5c..7dea5deec5 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -107,21 +107,26 @@ module ActiveRecord first = value.begin last = value.end unless first.respond_to?(:infinite?) && first.infinite? - binds << build_bind_param(column_name, first) + binds << build_bind_attribute(column_name, first) first = Arel::Nodes::BindParam.new end unless last.respond_to?(:infinite?) && last.infinite? - binds << build_bind_param(column_name, last) + binds << build_bind_attribute(column_name, last) last = Arel::Nodes::BindParam.new end result[column_name] = RangeHandler::RangeWithBinds.new(first, last, value.exclude_end?) + when value.is_a?(Relation) + binds.concat(value.bound_attributes) else if can_be_bound?(column_name, value) - result[column_name] = Arel::Nodes::BindParam.new - binds << build_bind_param(column_name, value) - elsif value.is_a?(Relation) - binds.concat(value.bound_attributes) + bind_attribute = build_bind_attribute(column_name, value) + if value.is_a?(StatementCache::Substitute) || !bind_attribute.value_for_database.nil? + result[column_name] = Arel::Nodes::BindParam.new + binds << bind_attribute + else + result[column_name] = nil + end end end end @@ -164,7 +169,7 @@ module ActiveRecord end end - def build_bind_param(column_name, value) + def build_bind_attribute(column_name, value) Relation::QueryAttribute.new(column_name.to_s, value, table.type(column_name)) end end diff --git a/activerecord/lib/active_record/relation/where_clause_factory.rb b/activerecord/lib/active_record/relation/where_clause_factory.rb index 04bee73e8f..b862dd56a5 100644 --- a/activerecord/lib/active_record/relation/where_clause_factory.rb +++ b/activerecord/lib/active_record/relation/where_clause_factory.rb @@ -57,7 +57,7 @@ module ActiveRecord else column = klass.column_for_attribute(attribute) - binds << predicate_builder.send(:build_bind_param, attribute, value) + binds << predicate_builder.send(:build_bind_attribute, attribute, value) value = Arel::Nodes::BindParam.new predicate = if options[:case_sensitive] diff --git a/activerecord/test/cases/enum_test.rb b/activerecord/test/cases/enum_test.rb index db3da53487..4ef9a125e6 100644 --- a/activerecord/test/cases/enum_test.rb +++ b/activerecord/test/cases/enum_test.rb @@ -60,6 +60,7 @@ class EnumTest < ActiveRecord::TestCase assert_not_equal @book, Book.where(status: [:written]).first assert_not_equal @book, Book.where.not(status: :published).first assert_equal @book, Book.where.not(status: :written).first + assert_equal books(:ddd), Book.where(read_status: :forgotten).first end test "find via where with strings" do @@ -69,6 +70,7 @@ class EnumTest < ActiveRecord::TestCase assert_not_equal @book, Book.where(status: ["written"]).first assert_not_equal @book, Book.where.not(status: "published").first assert_equal @book, Book.where.not(status: "written").first + assert_equal books(:ddd), Book.where(read_status: "forgotten").first end test "build from scope" do diff --git a/activerecord/test/cases/relation/where_test.rb b/activerecord/test/cases/relation/where_test.rb index cbc466d6b8..42dae4d569 100644 --- a/activerecord/test/cases/relation/where_test.rb +++ b/activerecord/test/cases/relation/where_test.rb @@ -15,7 +15,7 @@ require "models/vertex" module ActiveRecord class WhereTest < ActiveRecord::TestCase - fixtures :posts, :edges, :authors, :author_addresses, :binaries, :essays, :cars, :treasures, :price_estimates + fixtures :posts, :edges, :authors, :author_addresses, :binaries, :essays, :cars, :treasures, :price_estimates, :topics def test_where_copies_bind_params author = authors(:david) @@ -48,6 +48,10 @@ module ActiveRecord assert_equal [chef], chefs.to_a end + def test_where_with_casted_value_is_nil + assert_equal 4, Topic.where(last_read: "").count + end + def test_rewhere_on_root assert_equal posts(:welcome), Post.rewhere(title: "Welcome to the weblog").first end -- cgit v1.2.3 From 4bdd86fb1e608d0031ee5e03af4ae0b13b41fea3 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 1 Jun 2017 04:40:55 +0900 Subject: The receiver in a scope should be a `relation` Currently the receiver in a scope is `klass`, not `relation`. I think it is a strange because the receiver in `default_scope` and a scope on association is `relation`. I fixed to the receiver is to be a `relation` properly for consistency. --- activerecord/lib/active_record/scoping/named.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb index a61fdd6454..7748e1d40a 100644 --- a/activerecord/lib/active_record/scoping/named.rb +++ b/activerecord/lib/active_record/scoping/named.rb @@ -160,7 +160,7 @@ module ActiveRecord if body.respond_to?(:to_proc) singleton_class.send(:define_method, name) do |*args| scope = all - scope = scope.scoping { instance_exec(*args, &body) || scope } + scope = scope.instance_exec(*args, &body) || scope scope = scope.extending(extension) if extension scope end -- cgit v1.2.3 From 2b394c843f9d6fc866d5a37ca8dae73fc629a08f Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Fri, 2 Jun 2017 19:05:41 +0900 Subject: Remove the redundant `test_find_all_with_join` in AR --- activerecord/test/cases/finder_test.rb | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index 4837a169fa..420f552ef6 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -1023,16 +1023,6 @@ class FinderTest < ActiveRecord::TestCase assert_raise(ActiveRecord::StatementInvalid) { Topic.find_by_sql "select 1 from badtable" } end - def test_find_all_with_join - developers_on_project_one = Developer. - joins("LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id"). - where("project_id=1").to_a - assert_equal 3, developers_on_project_one.length - developer_names = developers_on_project_one.map(&:name) - assert_includes developer_names, "David" - assert_includes developer_names, "Jamis" - end - def test_joins_dont_clobber_id first = Firm. joins("INNER JOIN companies clients ON clients.firm_id = companies.id"). -- cgit v1.2.3 From bad1a267f1740156729656c5fe4bfb7ba769a481 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sat, 3 Jun 2017 18:24:14 +0900 Subject: Remove a redundant default_scope tests --- activerecord/test/cases/relations_test.rb | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 81173945a3..86f3b0b962 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -695,16 +695,6 @@ class RelationTest < ActiveRecord::TestCase end end - def test_default_scope_with_conditions_string - assert_equal Developer.where(name: "David").map(&:id).sort, DeveloperCalledDavid.all.map(&:id).sort - assert_nil DeveloperCalledDavid.create!.name - end - - def test_default_scope_with_conditions_hash - assert_equal Developer.where(name: "Jamis").map(&:id).sort, DeveloperCalledJamis.all.map(&:id).sort - assert_equal "Jamis", DeveloperCalledJamis.create!.name - end - def test_default_scoping_finder_methods developers = DeveloperCalledDavid.order("id").map(&:id).sort assert_equal Developer.where(name: "David").map(&:id).sort, developers -- cgit v1.2.3 From b6b0c99ff3e8ace3f42813154dbe4b8ad6a98e6c Mon Sep 17 00:00:00 2001 From: Genadi Samokovarov Date: Wed, 31 May 2017 12:16:20 +0300 Subject: Use mattr_accessor default: option throughout the project --- .../attribute_methods/time_zone_conversion.rb | 3 +-- .../lib/active_record/autosave_association.rb | 3 +-- activerecord/lib/active_record/core.rb | 19 ++++++------------- activerecord/lib/active_record/fixtures.rb | 3 +-- activerecord/lib/active_record/schema_dumper.rb | 3 +-- 5 files changed, 10 insertions(+), 21 deletions(-) (limited to 'activerecord') 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 4a8d231503..1f1efe8812 100644 --- a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb +++ b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb @@ -54,8 +54,7 @@ module ActiveRecord extend ActiveSupport::Concern included do - mattr_accessor :time_zone_aware_attributes, instance_writer: false - self.time_zone_aware_attributes = false + mattr_accessor :time_zone_aware_attributes, instance_writer: false, default: false class_attribute :skip_time_zone_conversion_for_attributes, instance_writer: false, default: [] class_attribute :time_zone_aware_types, instance_writer: false, default: [ :datetime, :time ] diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb index 829a4f6e86..70f0e2af8e 100644 --- a/activerecord/lib/active_record/autosave_association.rb +++ b/activerecord/lib/active_record/autosave_association.rb @@ -140,8 +140,7 @@ module ActiveRecord included do Associations::Builder::Association.extensions << AssociationBuilderExtension - mattr_accessor :index_nested_attribute_errors, instance_writer: false - self.index_nested_attribute_errors = false + mattr_accessor :index_nested_attribute_errors, instance_writer: false, default: false end module ClassMethods # :nodoc: diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 8f78330d4a..198c712abc 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -56,8 +56,7 @@ module ActiveRecord # :singleton-method: # Determines whether to use Time.utc (using :utc) or Time.local (using :local) when pulling # dates and times from the database. This is set to :utc by default. - mattr_accessor :default_timezone, instance_writer: false - self.default_timezone = :utc + mattr_accessor :default_timezone, instance_writer: false, default: :utc ## # :singleton-method: @@ -67,16 +66,14 @@ module ActiveRecord # ActiveRecord::Schema file which can be loaded into any database that # supports migrations. Use :ruby if you want to have different database # adapters for, e.g., your development and test environments. - mattr_accessor :schema_format, instance_writer: false - self.schema_format = :ruby + mattr_accessor :schema_format, instance_writer: false, default: :ruby ## # :singleton-method: # Specifies if an error should be raised if the query has an order being # ignored when doing batch queries. Useful in applications where the # scope being ignored is error-worthy, rather than a warning. - mattr_accessor :error_on_ignored_order, instance_writer: false - self.error_on_ignored_order = false + mattr_accessor :error_on_ignored_order, instance_writer: false, default: false def self.error_on_ignored_order_or_limit ActiveSupport::Deprecation.warn(<<-MSG.squish) @@ -101,8 +98,7 @@ module ActiveRecord ## # :singleton-method: # Specify whether or not to use timestamps for migration versions - mattr_accessor :timestamped_migrations, instance_writer: false - self.timestamped_migrations = true + mattr_accessor :timestamped_migrations, instance_writer: false, default: true ## # :singleton-method: @@ -110,8 +106,7 @@ module ActiveRecord # db:migrate rake task. This is true by default, which is useful for the # development environment. This should ideally be false in the production # environment where dumping schema is rarely needed. - mattr_accessor :dump_schema_after_migration, instance_writer: false - self.dump_schema_after_migration = true + mattr_accessor :dump_schema_after_migration, instance_writer: false, default: true ## # :singleton-method: @@ -120,8 +115,7 @@ module ActiveRecord # schema_search_path are dumped. Use :all to dump all schemas regardless # of schema_search_path, or a string of comma separated schemas for a # custom list. - mattr_accessor :dump_schemas, instance_writer: false - self.dump_schemas = :schema_search_path + mattr_accessor :dump_schemas, instance_writer: false, default: :schema_search_path ## # :singleton-method: @@ -130,7 +124,6 @@ module ActiveRecord # be used to identify queries which load thousands of records and # potentially cause memory bloat. mattr_accessor :warn_on_records_fetched_greater_than, instance_writer: false - self.warn_on_records_fetched_greater_than = nil mattr_accessor :maintain_test_schema, instance_accessor: false diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index bad6542be2..a6b66c91e3 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -492,8 +492,7 @@ module ActiveRecord end end - cattr_accessor :all_loaded_fixtures - self.all_loaded_fixtures = {} + cattr_accessor :all_loaded_fixtures, default: {} class ClassCache def initialize(class_names, config) diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index 24b81aabc8..66a2846f3a 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -13,8 +13,7 @@ module ActiveRecord # A list of tables which should not be dumped to the schema. # Acceptable values are strings as well as regexp if ActiveRecord::Base.schema_format == :ruby. # Only strings are accepted if ActiveRecord::Base.schema_format == :sql. - cattr_accessor :ignore_tables - @@ignore_tables = [] + cattr_accessor :ignore_tables, default: [] class << self def dump(connection = ActiveRecord::Base.connection, stream = STDOUT, config = ActiveRecord::Base) -- cgit v1.2.3 From d357da68ff06d10bc074f84eb09b4d9144c4136f Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Sat, 3 Jun 2017 19:23:01 +0530 Subject: [ci skip] Add missing `be` --- .../lib/active_record/connection_adapters/abstract/schema_statements.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord') 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 6cf8645cab..bcb939855f 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -188,7 +188,7 @@ module ActiveRecord # The name of the primary key, if one is to be added automatically. # Defaults to +id+. If :id is false, then this option is ignored. # - # If an array is passed, a composite primary key will created. + # If an array is passed, a composite primary key will be created. # # Note that Active Record models will automatically detect their # primary key. This can be avoided by using -- cgit v1.2.3 From 50a3d5ac8d1d5c6a7cdf7456d7894e883d962794 Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Sat, 3 Jun 2017 19:57:19 +0530 Subject: Remove assert_nothing_raised, as test is already testing the required concerns --- activerecord/test/cases/adapters/postgresql/uuid_test.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/adapters/postgresql/uuid_test.rb b/activerecord/test/cases/adapters/postgresql/uuid_test.rb index 6ebe9d82a7..d124b64861 100644 --- a/activerecord/test/cases/adapters/postgresql/uuid_test.rb +++ b/activerecord/test/cases/adapters/postgresql/uuid_test.rb @@ -64,11 +64,11 @@ class PostgresqlUUIDTest < ActiveRecord::PostgreSQLTestCase end def test_add_column_with_null_true_and_default_nil - assert_nothing_raised do - connection.add_column :uuid_data_type, :thingy, :uuid, null: true, default: nil - end + connection.add_column :uuid_data_type, :thingy, :uuid, null: true, default: nil + UUIDType.reset_column_information column = UUIDType.columns_hash["thingy"] + assert column.null assert_nil column.default end -- cgit v1.2.3 From e95d2a0f2f51298aebc5201551860fe8e7f8ece6 Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Mon, 5 Jun 2017 03:28:12 +0930 Subject: Don't mark the schema loaded until it's really finished load_schema! is overridden by attribute modules, so we need to wait until it has returned. --- activerecord/lib/active_record/model_schema.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb index 1179a60e9b..14e0f5bff7 100644 --- a/activerecord/lib/active_record/model_schema.rb +++ b/activerecord/lib/active_record/model_schema.rb @@ -446,7 +446,11 @@ module ActiveRecord def load_schema return if schema_loaded? @load_schema_monitor.synchronize do - load_schema! unless defined?(@columns_hash) && @columns_hash + return if defined?(@columns_hash) && @columns_hash + + load_schema! + + @schema_loaded = true end end @@ -460,8 +464,6 @@ module ActiveRecord user_provided_default: false ) end - - @schema_loaded = true end def reload_schema_from_cache -- cgit v1.2.3 From a7803190fff6e3647fcee3dd5aa6d468437aeee4 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Mon, 5 Jun 2017 20:31:49 +0900 Subject: Testing `ReservedWordTest` for all adapters `ReservedWordTest` expects that any identifiers are quoted properly. It should be tested for all adapters. --- .../cases/adapters/mysql2/reserved_word_test.rb | 151 --------------------- activerecord/test/cases/reserved_word_test.rb | 132 ++++++++++++++++++ 2 files changed, 132 insertions(+), 151 deletions(-) delete mode 100644 activerecord/test/cases/adapters/mysql2/reserved_word_test.rb create mode 100644 activerecord/test/cases/reserved_word_test.rb (limited to 'activerecord') diff --git a/activerecord/test/cases/adapters/mysql2/reserved_word_test.rb b/activerecord/test/cases/adapters/mysql2/reserved_word_test.rb deleted file mode 100644 index 2c778b1150..0000000000 --- a/activerecord/test/cases/adapters/mysql2/reserved_word_test.rb +++ /dev/null @@ -1,151 +0,0 @@ -require "cases/helper" - -# a suite of tests to ensure the ConnectionAdapters#MysqlAdapter can handle tables with -# reserved word names (ie: group, order, values, etc...) -class Mysql2ReservedWordTest < ActiveRecord::Mysql2TestCase - class Group < ActiveRecord::Base - Group.table_name = "group" - belongs_to :select - has_one :values - end - - class Select < ActiveRecord::Base - Select.table_name = "select" - has_many :groups - end - - class Values < ActiveRecord::Base - Values.table_name = "values" - end - - class Distinct < ActiveRecord::Base - Distinct.table_name = "distinct" - has_and_belongs_to_many :selects - has_many :values, through: :groups - end - - def setup - @connection = ActiveRecord::Base.connection - - # we call execute directly here (and do similar below) because ActiveRecord::Base#create_table() - # will fail with these table names if these test cases fail - - create_tables_directly "group" => "id int auto_increment primary key, `order` varchar(255), select_id int", - "select" => "id int auto_increment primary key", - "values" => "id int auto_increment primary key, group_id int", - "distinct" => "id int auto_increment primary key", - "distinct_select" => "distinct_id int, select_id int" - end - - teardown do - drop_tables_directly ["group", "select", "values", "distinct", "distinct_select", "order"] - end - - # create tables with reserved-word names and columns - def test_create_tables - assert_nothing_raised { - @connection.create_table :order do |t| - t.column :group, :string - end - } - end - - # rename tables with reserved-word names - def test_rename_tables - assert_nothing_raised { @connection.rename_table(:group, :order) } - end - - # alter column with a reserved-word name in a table with a reserved-word name - def test_change_columns - assert_nothing_raised { @connection.change_column_default(:group, :order, "whatever") } - #the quoting here will reveal any double quoting issues in change_column's interaction with the column method in the adapter - assert_nothing_raised { @connection.change_column("group", "order", :Int, default: 0) } - assert_nothing_raised { @connection.rename_column(:group, :order, :values) } - end - - # introspect table with reserved word name - def test_introspect - assert_nothing_raised { @connection.columns(:group) } - assert_nothing_raised { @connection.indexes(:group) } - end - - #fixtures - self.use_instantiated_fixtures = true - self.use_transactional_tests = false - - #activerecord model class with reserved-word table name - def test_activerecord_model - create_test_fixtures :select, :distinct, :group, :values, :distinct_select - x = nil - assert_nothing_raised { x = Group.new } - x.order = "x" - assert_nothing_raised { x.save } - x.order = "y" - assert_nothing_raised { x.save } - assert_nothing_raised { Group.find_by_order("y") } - assert_nothing_raised { Group.find(1) } - end - - # has_one association with reserved-word table name - def test_has_one_associations - create_test_fixtures :select, :distinct, :group, :values, :distinct_select - v = nil - assert_nothing_raised { v = Group.find(1).values } - assert_equal 2, v.id - end - - # belongs_to association with reserved-word table name - def test_belongs_to_associations - create_test_fixtures :select, :distinct, :group, :values, :distinct_select - gs = nil - assert_nothing_raised { gs = Select.find(2).groups } - assert_equal gs.length, 2 - assert(gs.collect(&:id).sort == [2, 3]) - end - - # has_and_belongs_to_many with reserved-word table name - def test_has_and_belongs_to_many - create_test_fixtures :select, :distinct, :group, :values, :distinct_select - s = nil - assert_nothing_raised { s = Distinct.find(1).selects } - assert_equal s.length, 2 - assert(s.collect(&:id).sort == [1, 2]) - end - - # activerecord model introspection with reserved-word table and column names - def test_activerecord_introspection - assert_nothing_raised { Group.table_exists? } - assert_nothing_raised { Group.columns } - end - - # Calculations - def test_calculations_work_with_reserved_words - assert_nothing_raised { Group.count } - end - - def test_associations_work_with_reserved_words - assert_nothing_raised { Select.all.merge!(includes: [:groups]).to_a } - end - - #the following functions were added to DRY test cases - - private - # custom fixture loader, uses FixtureSet#create_fixtures and appends base_path to the current file's path - def create_test_fixtures(*fixture_names) - ActiveRecord::FixtureSet.create_fixtures(FIXTURES_ROOT + "/reserved_words", fixture_names) - end - - # custom drop table, uses execute on connection to drop a table if it exists. note: escapes table_name - def drop_tables_directly(table_names, connection = @connection) - table_names.each do |name| - connection.drop_table name, if_exists: true - end - end - - # custom create table, uses execute on connection to create a table, note: escapes table_name, does NOT escape columns - def create_tables_directly(tables, connection = @connection) - tables.each do |table_name, column_properties| - connection.execute("CREATE TABLE `#{table_name}` ( #{column_properties} )") - end - end -end diff --git a/activerecord/test/cases/reserved_word_test.rb b/activerecord/test/cases/reserved_word_test.rb new file mode 100644 index 0000000000..f3019a5326 --- /dev/null +++ b/activerecord/test/cases/reserved_word_test.rb @@ -0,0 +1,132 @@ +require "cases/helper" + +class ReservedWordTest < ActiveRecord::TestCase + self.use_instantiated_fixtures = true + self.use_transactional_tests = false + + class Group < ActiveRecord::Base + Group.table_name = "group" + belongs_to :select + has_one :values + end + + class Select < ActiveRecord::Base + Select.table_name = "select" + has_many :groups + end + + class Values < ActiveRecord::Base + Values.table_name = "values" + end + + class Distinct < ActiveRecord::Base + Distinct.table_name = "distinct" + has_and_belongs_to_many :selects + has_many :values, through: :groups + end + + def setup + @connection = ActiveRecord::Base.connection + @connection.create_table :select, force: true + @connection.create_table :distinct, force: true + @connection.create_table :distinct_select, id: false, force: true do |t| + t.belongs_to :distinct + t.belongs_to :select + end + @connection.create_table :group, force: true do |t| + t.string :order + t.belongs_to :select + end + @connection.create_table :values, force: true do |t| + t.belongs_to :group + end + end + + def teardown + @connection.drop_table :select, if_exists: true + @connection.drop_table :distinct, if_exists: true + @connection.drop_table :distinct_select, if_exists: true + @connection.drop_table :group, if_exists: true + @connection.drop_table :values, if_exists: true + @connection.drop_table :order, if_exists: true + end + + def test_create_tables + assert_not @connection.table_exists?(:order) + + @connection.create_table :order do |t| + t.string :group + end + + assert @connection.table_exists?(:order) + end + + def test_rename_tables + assert_nothing_raised { @connection.rename_table(:group, :order) } + end + + def test_change_columns + assert_nothing_raised { @connection.change_column_default(:group, :order, "whatever") } + assert_nothing_raised { @connection.change_column("group", "order", :text, default: nil) } + assert_nothing_raised { @connection.rename_column(:group, :order, :values) } + end + + def test_introspect + assert_equal ["id", "order", "select_id"], @connection.columns(:group).map(&:name).sort + assert_equal ["index_group_on_select_id"], @connection.indexes(:group).map(&:name).sort + end + + def test_activerecord_model + x = Group.new + x.order = "x" + x.save! + x.order = "y" + x.save! + assert_equal x, Group.find_by_order("y") + assert_equal x, Group.find(x.id) + end + + def test_has_one_associations + create_test_fixtures :group, :values + v = Group.find(1).values + assert_equal 2, v.id + end + + def test_belongs_to_associations + create_test_fixtures :select, :group + gs = Select.find(2).groups + assert_equal 2, gs.length + assert_equal [2, 3], gs.collect(&:id).sort + end + + def test_has_and_belongs_to_many + create_test_fixtures :select, :distinct, :distinct_select + s = Distinct.find(1).selects + assert_equal 2, s.length + assert_equal [1, 2], s.collect(&:id).sort + end + + def test_activerecord_introspection + assert Group.table_exists? + assert_equal ["id", "order", "select_id"], Group.columns.map(&:name).sort + end + + def test_calculations_work_with_reserved_words + create_test_fixtures :group + assert_equal 3, Group.count + end + + def test_associations_work_with_reserved_words + create_test_fixtures :select, :group + selects = Select.all.merge!(includes: [:groups]).to_a + assert_no_queries do + selects.each { |select| select.groups } + end + end + + private + # custom fixture loader, uses FixtureSet#create_fixtures and appends base_path to the current file's path + def create_test_fixtures(*fixture_names) + ActiveRecord::FixtureSet.create_fixtures(FIXTURES_ROOT + "/reserved_words", fixture_names) + end +end -- cgit v1.2.3 From 669758fb6183f7fc9b13a44143f6b07ef0fd230b Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Tue, 6 Jun 2017 09:01:31 +0900 Subject: Remove redundant `assert_nothing_raised` before another assertions These `assert_nothing_raised` are covered by following assertions. --- activerecord/test/cases/adapters/postgresql/geometric_test.rb | 2 -- activerecord/test/cases/associations/cascaded_eager_loading_test.rb | 6 ------ activerecord/test/cases/associations/eager_test.rb | 3 --- 3 files changed, 11 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/adapters/postgresql/geometric_test.rb b/activerecord/test/cases/adapters/postgresql/geometric_test.rb index c1f3a4ae2c..3b6840a1c9 100644 --- a/activerecord/test/cases/adapters/postgresql/geometric_test.rb +++ b/activerecord/test/cases/adapters/postgresql/geometric_test.rb @@ -93,8 +93,6 @@ class PostgresqlPointTest < ActiveRecord::PostgreSQLTestCase end def test_empty_string_assignment - assert_nothing_raised { PostgresqlPoint.new(x: "") } - p = PostgresqlPoint.new(x: "") assert_nil p.x end diff --git a/activerecord/test/cases/associations/cascaded_eager_loading_test.rb b/activerecord/test/cases/associations/cascaded_eager_loading_test.rb index 3638c87968..7b0445025c 100644 --- a/activerecord/test/cases/associations/cascaded_eager_loading_test.rb +++ b/activerecord/test/cases/associations/cascaded_eager_loading_test.rb @@ -34,18 +34,12 @@ class CascadedEagerLoadingTest < ActiveRecord::TestCase end def test_eager_association_loading_with_hmt_does_not_table_name_collide_when_joining_associations - assert_nothing_raised do - Author.joins(:posts).eager_load(:comments).where(posts: { tags_count: 1 }).to_a - end authors = Author.joins(:posts).eager_load(:comments).where(posts: { tags_count: 1 }).to_a assert_equal 1, assert_no_queries { authors.size } assert_equal 10, assert_no_queries { authors[0].comments.size } end def test_eager_association_loading_grafts_stashed_associations_to_correct_parent - assert_nothing_raised do - Person.eager_load(primary_contact: :primary_contact).where("primary_contacts_people_2.first_name = ?", "Susan").order("people.id").to_a - end assert_equal people(:michael), Person.eager_load(primary_contact: :primary_contact).where("primary_contacts_people_2.first_name = ?", "Susan").order("people.id").first end diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index 4271a09c9b..55b294cfaa 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -271,9 +271,6 @@ class EagerAssociationTest < ActiveRecord::TestCase end def test_loading_from_an_association_that_has_a_hash_of_conditions - assert_nothing_raised do - Author.all.merge!(includes: :hello_posts_with_hash_conditions).to_a - end assert !Author.all.merge!(includes: :hello_posts_with_hash_conditions).find(authors(:david).id).hello_posts.empty? end -- cgit v1.2.3 From 46ca735a0170e28db49fa48939ed697e97ed9f54 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Tue, 6 Jun 2017 09:22:15 +0900 Subject: [ci skip] UNIQUE constraint affects not only INSERT but also UPDATE --- activerecord/lib/active_record/errors.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/errors.rb b/activerecord/lib/active_record/errors.rb index 18fac5af1b..60d4fb70e0 100644 --- a/activerecord/lib/active_record/errors.rb +++ b/activerecord/lib/active_record/errors.rb @@ -105,7 +105,7 @@ module ActiveRecord class WrappedDatabaseException < StatementInvalid end - # Raised when a record cannot be inserted because it would violate a uniqueness constraint. + # Raised when a record cannot be inserted or updated because it would violate a uniqueness constraint. class RecordNotUnique < WrappedDatabaseException end -- cgit v1.2.3 From b8dea23c4abe38b4599cf2faf72283e16d248fba Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Tue, 6 Jun 2017 19:09:26 +0900 Subject: Fix `test_pluck_without_column_names` when using Oracle --- activerecord/test/cases/calculations_test.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index 21c5c0efee..80baaac30a 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -580,8 +580,11 @@ class CalculationsTest < ActiveRecord::TestCase end def test_pluck_without_column_names - assert_equal [[1, "Firm", 1, nil, "37signals", nil, 1, nil, ""]], - Company.order(:id).limit(1).pluck + if current_adapter?(:OracleAdapter) + assert_equal [[1, "Firm", 1, nil, "37signals", nil, 1, nil, nil]], Company.order(:id).limit(1).pluck + else + assert_equal [[1, "Firm", 1, nil, "37signals", nil, 1, nil, ""]], Company.order(:id).limit(1).pluck + end end def test_pluck_type_cast -- cgit v1.2.3 From eeb83fe9702f861608deab9d6b038f8a510ccc8d Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Thu, 1 Jun 2017 13:38:12 +0000 Subject: PostgreSQL 10 converts unknown OID 705 to text 25 - Rename test cases from `unknown` to `unrecognized` since unknown OID is one of possible unrecognized types by Rails - Use "select 'pg_catalog.pg_class'::regclass" whose OID is 2205, which will not be converted to recognized type in PostgreSQL 10. activerecord_unittest=# select oid, typname from pg_type where oid in (2205, 2277); oid | typname ------+---------- 2205 | regclass 2277 | anyarray (2 rows) Addresses #28868 --- .../cases/adapters/postgresql/postgresql_adapter_test.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb index bfc763e1ef..76e0ad60fe 100644 --- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb +++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb @@ -324,13 +324,13 @@ module ActiveRecord reset_connection end - def test_only_reload_type_map_once_for_every_unknown_type + def test_only_reload_type_map_once_for_every_unrecognized_type silence_warnings do assert_queries 2, ignore_none: true do - @connection.select_all "SELECT NULL::anyelement" + @connection.select_all "select 'pg_catalog.pg_class'::regclass" end assert_queries 1, ignore_none: true do - @connection.select_all "SELECT NULL::anyelement" + @connection.select_all "select 'pg_catalog.pg_class'::regclass" end assert_queries 2, ignore_none: true do @connection.select_all "SELECT NULL::anyarray" @@ -340,13 +340,13 @@ module ActiveRecord reset_connection end - def test_only_warn_on_first_encounter_of_unknown_oid + def test_only_warn_on_first_encounter_of_unrecognized_oid warning = capture(:stderr) { - @connection.select_all "SELECT NULL::anyelement" - @connection.select_all "SELECT NULL::anyelement" - @connection.select_all "SELECT NULL::anyelement" + @connection.select_all "select 'pg_catalog.pg_class'::regclass" + @connection.select_all "select 'pg_catalog.pg_class'::regclass" + @connection.select_all "select 'pg_catalog.pg_class'::regclass" } - assert_match(/\Aunknown OID \d+: failed to recognize type of 'anyelement'\. It will be treated as String\.\n\z/, warning) + assert_match(/\Aunknown OID \d+: failed to recognize type of 'regclass'\. It will be treated as String\.\n\z/, warning) ensure reset_connection end -- cgit v1.2.3 From 9b8c7796a9c2048208aa843ad3dc477dffa8bdee Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Tue, 6 Jun 2017 11:56:12 +0900 Subject: Avoid overwriting the methods of `AttributeMethods::PrimaryKey` Currently the methods of `AttributeMethods::PrimaryKey` are overwritten by `define_attribute_methods`. It will be broken if a table that customized primary key has non primary key id column. It should not be overwritten if a table has any primary key. Fixes #29350. --- .../lib/active_record/attribute_methods/primary_key.rb | 10 +++------- activerecord/test/cases/primary_keys_test.rb | 17 ++++++++++++----- activerecord/test/cases/schema_dumper_test.rb | 2 +- activerecord/test/schema/schema.rb | 14 ++++++++------ 4 files changed, 24 insertions(+), 19 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/attribute_methods/primary_key.rb b/activerecord/lib/active_record/attribute_methods/primary_key.rb index 2f32caa257..b5fd0cb370 100644 --- a/activerecord/lib/active_record/attribute_methods/primary_key.rb +++ b/activerecord/lib/active_record/attribute_methods/primary_key.rb @@ -57,16 +57,12 @@ module ActiveRecord end module ClassMethods - def define_method_attribute(attr_name) - super + ID_ATTRIBUTE_METHODS = %w(id id= id? id_before_type_cast id_was id_in_database).to_set - if attr_name == primary_key && attr_name != "id" - generated_attribute_methods.send(:alias_method, :id, primary_key) - end + def instance_method_already_implemented?(method_name) + super || primary_key && ID_ATTRIBUTE_METHODS.include?(method_name) end - ID_ATTRIBUTE_METHODS = %w(id id= id? id_before_type_cast id_was id_in_database).to_set - def dangerous_attribute_method?(method_name) super && !ID_ATTRIBUTE_METHODS.include?(method_name) end diff --git a/activerecord/test/cases/primary_keys_test.rb b/activerecord/test/cases/primary_keys_test.rb index 5ded619716..200d9e6434 100644 --- a/activerecord/test/cases/primary_keys_test.rb +++ b/activerecord/test/cases/primary_keys_test.rb @@ -46,7 +46,7 @@ class PrimaryKeysTest < ActiveRecord::TestCase topic = Topic.new topic.title = "New Topic" assert_nil topic.id - assert_nothing_raised { topic.save! } + topic.save! id = topic.id topicReloaded = Topic.find(id) @@ -56,23 +56,30 @@ class PrimaryKeysTest < ActiveRecord::TestCase def test_customized_primary_key_auto_assigns_on_save Keyboard.delete_all keyboard = Keyboard.new(name: "HHKB") - assert_nothing_raised { keyboard.save! } + keyboard.save! assert_equal keyboard.id, Keyboard.find_by_name("HHKB").id end def test_customized_primary_key_can_be_get_before_saving keyboard = Keyboard.new assert_nil keyboard.id - assert_nothing_raised { assert_nil keyboard.key_number } + assert_nil keyboard.key_number end def test_customized_string_primary_key_settable_before_save subscriber = Subscriber.new - assert_nothing_raised { subscriber.id = "webster123" } + subscriber.id = "webster123" assert_equal "webster123", subscriber.id assert_equal "webster123", subscriber.nick end + def test_update_with_non_primary_key_id_column + subscriber = Subscriber.first + subscriber.update(update_count: 1) + subscriber.reload + assert_equal 1, subscriber.update_count + end + def test_string_key subscriber = Subscriber.find(subscribers(:first).nick) assert_equal(subscribers(:first).name, subscriber.name) @@ -83,7 +90,7 @@ class PrimaryKeysTest < ActiveRecord::TestCase subscriber.id = "jdoe" assert_equal("jdoe", subscriber.id) subscriber.name = "John Doe" - assert_nothing_raised { subscriber.save! } + subscriber.save! assert_equal("jdoe", subscriber.id) subscriberReloaded = Subscriber.find("jdoe") diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb index 417c6f4832..b5386ba801 100644 --- a/activerecord/test/cases/schema_dumper_test.rb +++ b/activerecord/test/cases/schema_dumper_test.rb @@ -320,7 +320,7 @@ class SchemaDumperTest < ActiveRecord::TestCase def test_schema_dump_keeps_id_false_when_id_is_false_and_unique_not_null_column_added output = standard_dump - assert_match %r{create_table "subscribers", id: false}, output + assert_match %r{create_table "string_key_objects", id: false}, output end if ActiveRecord::Base.connection.supports_foreign_keys? diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index 50f1d9bfe7..8863736943 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -807,16 +807,18 @@ ActiveRecord::Schema.define do t.string :sponsorable_type end - create_table :string_key_objects, id: false, primary_key: :id, force: true do |t| - t.string :id - t.string :name - t.integer :lock_version, null: false, default: 0 + create_table :string_key_objects, id: false, force: true do |t| + t.string :id, null: false + t.string :name + t.integer :lock_version, null: false, default: 0 + t.index :id, unique: true end - create_table :subscribers, force: true, id: false do |t| + create_table :subscribers, force: true do |t| t.string :nick, null: false t.string :name - t.column :books_count, :integer, null: false, default: 0 + t.integer :books_count, null: false, default: 0 + t.integer :update_count, null: false, default: 0 t.index :nick, unique: true end -- cgit v1.2.3 From 9048a70f34b8109be24b2da1009a2f4607ec66bf Mon Sep 17 00:00:00 2001 From: Alex Kitchens Date: Thu, 8 Jun 2017 16:11:45 -0500 Subject: Raise on create for singular association when parent is unpersisted A collection association will raise on `#create_association` when the parent is unpersisted. A singular association should do the same. This addresses issue #29219. --- .../lib/active_record/associations/singular_association.rb | 4 ++++ .../test/cases/associations/has_one_associations_test.rb | 9 +++++++++ activerecord/test/cases/nested_attributes_test.rb | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/singular_association.rb b/activerecord/lib/active_record/associations/singular_association.rb index 91580a28d0..ca138635d2 100644 --- a/activerecord/lib/active_record/associations/singular_association.rb +++ b/activerecord/lib/active_record/associations/singular_association.rb @@ -63,6 +63,10 @@ module ActiveRecord end def _create_record(attributes, raise_error = false) + unless owner.persisted? + raise ActiveRecord::RecordNotSaved, "You cannot call create unless the parent is saved" + end + record = build_record(attributes) yield(record) if block_given? saved = record.save diff --git a/activerecord/test/cases/associations/has_one_associations_test.rb b/activerecord/test/cases/associations/has_one_associations_test.rb index 7c11d2e7fc..bf3b8dcd63 100644 --- a/activerecord/test/cases/associations/has_one_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_associations_test.rb @@ -307,6 +307,15 @@ class HasOneAssociationsTest < ActiveRecord::TestCase end end + def test_create_when_parent_is_new_raises + firm = Firm.new + error = assert_raise(ActiveRecord::RecordNotSaved) do + firm.create_account + end + + assert_equal "You cannot call create unless the parent is saved", error.message + end + def test_reload_association odegy = companies(:odegy) diff --git a/activerecord/test/cases/nested_attributes_test.rb b/activerecord/test/cases/nested_attributes_test.rb index 5a62cbd3a6..154faa56aa 100644 --- a/activerecord/test/cases/nested_attributes_test.rb +++ b/activerecord/test/cases/nested_attributes_test.rb @@ -117,7 +117,7 @@ class TestNestedAttributesInGeneral < ActiveRecord::TestCase def test_reject_if_with_a_proc_which_returns_true_always_for_has_one Pirate.accepts_nested_attributes_for :ship, reject_if: proc { |attributes| true } - pirate = Pirate.new(catchphrase: "Stop wastin' me time") + pirate = Pirate.create(catchphrase: "Stop wastin' me time") ship = pirate.create_ship(name: "s1") pirate.update(ship_attributes: { name: "s2", id: ship.id }) assert_equal "s1", ship.reload.name -- cgit v1.2.3 From fe8658eb3d2f13491c2495d690064ca84c493d10 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sat, 10 Jun 2017 19:36:19 +0900 Subject: Remove `null_allowed` option from doc [ci skip] This option was added in b9fa354. But it does not seem to work. --- .../active_record/connection_adapters/abstract/schema_statements.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'activerecord') 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 bcb939855f..a1031ccbf5 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -512,8 +512,7 @@ module ActiveRecord # * :default - # The column's default value. Use +nil+ for +NULL+. # * :null - - # Allows or disallows +NULL+ values in the column. This option could - # have been named :null_allowed. + # Allows or disallows +NULL+ values in the column. # * :precision - # Specifies the precision for the :decimal and :numeric columns. # * :scale - -- cgit v1.2.3 From c073240f70de81639a340ab68b001a77ffb6237e Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 11 Jun 2017 21:59:36 +0900 Subject: Remove unused defined association `belongs_to :developer` on `Comment` model was added in 431f8e0 but it is unused. --- activerecord/test/cases/relation/merging_test.rb | 2 +- activerecord/test/models/comment.rb | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/relation/merging_test.rb b/activerecord/test/cases/relation/merging_test.rb index c3b39a9295..3901824aac 100644 --- a/activerecord/test/cases/relation/merging_test.rb +++ b/activerecord/test/cases/relation/merging_test.rb @@ -143,7 +143,7 @@ class MergingDifferentRelationsTest < ActiveRecord::TestCase assert_equal ["Mary", "Mary", "Mary", "David"], posts_by_author_name end - test "relation merging (using a proc argument)" do + test "relation merging (using a proc argument)" do dev = Developer.where(name: "Jamis").first comment_1 = dev.comments.create!(body: "I'm Jamis", post: Post.first) diff --git a/activerecord/test/models/comment.rb b/activerecord/test/models/comment.rb index d227f6fe86..eecf923046 100644 --- a/activerecord/test/models/comment.rb +++ b/activerecord/test/models/comment.rb @@ -9,7 +9,6 @@ class Comment < ActiveRecord::Base belongs_to :post, counter_cache: true belongs_to :author, polymorphic: true belongs_to :resource, polymorphic: true - belongs_to :developer has_many :ratings -- cgit v1.2.3 From 8c1b87f6490fc66bd05d6137f45a1c148f43ecca Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 11 Jun 2017 22:15:09 +0900 Subject: Remove unused `Subject` model in tests Because `subjects` table doesn't exist. --- activerecord/test/models/subject.rb | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 activerecord/test/models/subject.rb (limited to 'activerecord') diff --git a/activerecord/test/models/subject.rb b/activerecord/test/models/subject.rb deleted file mode 100644 index 504f68a296..0000000000 --- a/activerecord/test/models/subject.rb +++ /dev/null @@ -1,14 +0,0 @@ -# used for OracleSynonymTest, see test/synonym_test_oracle.rb -# -class Subject < ActiveRecord::Base - # added initialization of author_email_address in the same way as in Topic class - # as otherwise synonym test was failing - after_initialize :set_email_address - - private - def set_email_address - unless persisted? - self.author_email_address = "test@test.com" - end - end -end -- cgit v1.2.3 From 7b1ee9f54c5906b49b60b300212e17e0290e8ee5 Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Sat, 22 Apr 2017 14:01:59 +0300 Subject: Add test cases for optimistic locking Add test to ensure that locking_column cannot be updated explicitly. Add test to prevent regression on creating new object with explicit value locking_column. Related to #28318 --- activerecord/test/cases/locking_test.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'activerecord') diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb index 3a3b8e51f9..2b139a5da4 100644 --- a/activerecord/test/cases/locking_test.rb +++ b/activerecord/test/cases/locking_test.rb @@ -167,6 +167,12 @@ class OptimisticLockingTest < ActiveRecord::TestCase assert_equal 0, p1.lock_version end + def test_lock_new_when_explicitly_passing_value + p1 = Person.new(first_name: "Douglas Adams", lock_version: 42) + p1.save! + assert_equal 42, p1.lock_version + end + def test_touch_existing_lock p1 = Person.find(1) assert_equal 0, p1.lock_version @@ -186,6 +192,19 @@ class OptimisticLockingTest < ActiveRecord::TestCase end end + def test_explicit_update_lock_column_raise_error + person = Person.find(1) + + assert_raises(ActiveRecord::StaleObjectError) do + person.first_name = "Douglas Adams" + person.lock_version = 42 + + assert person.lock_version_changed? + + person.save + end + end + def test_lock_column_name_existing t1 = LegacyThing.find(1) t2 = LegacyThing.find(1) -- cgit v1.2.3 From 89d562edbac3a2cfb9f31b1019feed7139cf7067 Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Sat, 22 Apr 2017 14:23:30 +0300 Subject: Clean up 'Optimistic Locking' implementation --- activerecord/lib/active_record/locking/optimistic.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 3c7110369b..f8fcb7ccaa 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -62,8 +62,8 @@ module ActiveRecord def increment_lock lock_col = self.class.locking_column - previous_lock_value = send(lock_col).to_i - send(lock_col + "=", previous_lock_value + 1) + previous_lock_value = send(lock_col) + send("#{lock_col}=", previous_lock_value + 1) end def _create_record(attribute_names = self.attribute_names, *) @@ -107,7 +107,8 @@ module ActiveRecord # If something went wrong, revert the locking_column value. rescue Exception - send(lock_col + "=", previous_lock_value.to_i) + send("#{lock_col}=", previous_lock_value.to_i) + raise end end -- cgit v1.2.3 From 7dbe62006da2576770babe92234467574834f305 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Tue, 13 Jun 2017 10:55:29 +0900 Subject: Fix `create_table` with query from relation If a relation has binds, `connection.to_sql(relation)` without binds will generate invalid SQL. It should use `relation.to_sql` in that case. --- .../connection_adapters/abstract/schema_creation.rb | 7 ++++++- activerecord/test/cases/migration_test.rb | 10 ++++------ 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb index a4fecc4a8e..93f4529202 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb @@ -55,7 +55,7 @@ module ActiveRecord create_sql << "(#{statements.join(', ')})" if statements.present? add_table_options!(create_sql, table_options(o)) - create_sql << " AS #{@conn.to_sql(o.as)}" if o.as + create_sql << " AS #{to_sql(o.as)}" if o.as create_sql end @@ -114,6 +114,11 @@ module ActiveRecord sql end + def to_sql(sql) + sql = sql.to_sql if sql.respond_to?(:to_sql) + sql + end + def foreign_key_in_create(from_table, to_table, options) options = foreign_key_options(from_table, to_table, options) accept ForeignKeyDefinition.new(from_table, to_table, options) diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index 57f94950f9..3a49a41580 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -502,11 +502,10 @@ class MigrationTest < ActiveRecord::TestCase unless mysql_enforcing_gtid_consistency? def test_create_table_with_query - Person.connection.create_table(:person, force: true) - - Person.connection.create_table :table_from_query_testings, as: "SELECT id FROM person" + Person.connection.create_table :table_from_query_testings, as: "SELECT id FROM people WHERE id = 1" columns = Person.connection.columns(:table_from_query_testings) + assert_equal [1], Person.connection.select_values("SELECT * FROM table_from_query_testings") assert_equal 1, columns.length assert_equal "id", columns.first.name ensure @@ -514,11 +513,10 @@ class MigrationTest < ActiveRecord::TestCase end def test_create_table_with_query_from_relation - Person.connection.create_table(:person, force: true) - - Person.connection.create_table :table_from_query_testings, as: Person.select(:id) + Person.connection.create_table :table_from_query_testings, as: Person.select(:id).where(id: 1) columns = Person.connection.columns(:table_from_query_testings) + assert_equal [1], Person.connection.select_values("SELECT * FROM table_from_query_testings") assert_equal 1, columns.length assert_equal "id", columns.first.name ensure -- cgit v1.2.3 From d9230792ba474d0ff644cc3dc4a3975879bb049c Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Tue, 13 Jun 2017 23:32:44 +0900 Subject: Add test for backward compatibility when using change_table --- activerecord/test/cases/migration/compatibility_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'activerecord') diff --git a/activerecord/test/cases/migration/compatibility_test.rb b/activerecord/test/cases/migration/compatibility_test.rb index 7a80bfb899..596a21dcbc 100644 --- a/activerecord/test/cases/migration/compatibility_test.rb +++ b/activerecord/test/cases/migration/compatibility_test.rb @@ -90,6 +90,21 @@ module ActiveRecord connection.drop_table :more_testings rescue nil end + def test_timestamps_have_null_constraints_if_not_present_in_migration_of_change_table + migration = Class.new(ActiveRecord::Migration[4.2]) { + def migrate(x) + change_table :testings do |t| + t.timestamps + end + end + }.new + + ActiveRecord::Migrator.new(:up, [migration]).migrate + + assert connection.columns(:testings).find { |c| c.name == "created_at" }.null + assert connection.columns(:testings).find { |c| c.name == "updated_at" }.null + end + def test_timestamps_have_null_constraints_if_not_present_in_migration_for_adding_timestamps_to_existing_table migration = Class.new(ActiveRecord::Migration[4.2]) { def migrate(x) -- cgit v1.2.3 From 6673cf7071094e87d473459452a2d0e4c2ccfebe Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Sun, 11 Jun 2017 15:59:23 +0300 Subject: Use `require_relative` instead of `require` with full path --- activerecord/Rakefile | 4 ++-- activerecord/bin/test | 2 +- activerecord/test/cases/errors_test.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'activerecord') diff --git a/activerecord/Rakefile b/activerecord/Rakefile index 2d0d5bd657..fe5f9d1071 100644 --- a/activerecord/Rakefile +++ b/activerecord/Rakefile @@ -1,7 +1,7 @@ require "rake/testtask" -require File.expand_path("test/config", __dir__) -require File.expand_path("test/support/config", __dir__) +require_relative "test/config" +require_relative "test/support/config" def run_without_aborting(*tasks) errors = [] diff --git a/activerecord/bin/test b/activerecord/bin/test index 3a9547e5c1..ab69f4f603 100755 --- a/activerecord/bin/test +++ b/activerecord/bin/test @@ -1,7 +1,7 @@ #!/usr/bin/env ruby COMPONENT_ROOT = File.expand_path("..", __dir__) -require File.expand_path("../tools/test", COMPONENT_ROOT) +require_relative "../../tools/test" module Minitest def self.plugin_active_record_options(opts, options) diff --git a/activerecord/test/cases/errors_test.rb b/activerecord/test/cases/errors_test.rb index 73feb831d0..e90669e0c7 100644 --- a/activerecord/test/cases/errors_test.rb +++ b/activerecord/test/cases/errors_test.rb @@ -1,4 +1,4 @@ -require_relative "../cases/helper" +require "cases/helper" class ErrorsTest < ActiveRecord::TestCase def test_can_be_instantiated_with_no_args -- cgit v1.2.3 From b0180c910ee28efa8dd972401156062c8800707d Mon Sep 17 00:00:00 2001 From: Eugene Kenny Date: Sat, 10 Jun 2017 23:21:12 +0100 Subject: Allow `uuid_test.rb` to be loaded on all adapters Running `bin/test` from the activerecord directory produces this error: test/cases/adapters/postgresql/uuid_test.rb:43:in `': undefined method `supports_pgcrypto_uuid?' for # (NoMethodError) The test only actually runs on the PostgreSQL adapter; we can avoid triggering the error on other adapters with this `respond_to?` guard. --- activerecord/test/cases/adapters/postgresql/uuid_test.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/adapters/postgresql/uuid_test.rb b/activerecord/test/cases/adapters/postgresql/uuid_test.rb index d124b64861..8eddd81c38 100644 --- a/activerecord/test/cases/adapters/postgresql/uuid_test.rb +++ b/activerecord/test/cases/adapters/postgresql/uuid_test.rb @@ -40,7 +40,8 @@ class PostgresqlUUIDTest < ActiveRecord::PostgreSQLTestCase drop_table "uuid_data_type" end - if ActiveRecord::Base.connection.supports_pgcrypto_uuid? + if ActiveRecord::Base.connection.respond_to?(:supports_pgcrypto_uuid?) && + ActiveRecord::Base.connection.supports_pgcrypto_uuid? def test_uuid_column_default connection.add_column :uuid_data_type, :thingy, :uuid, null: false, default: "gen_random_uuid()" UUIDType.reset_column_information -- cgit v1.2.3 From f5f7ca57da2a486b4d2493cb70479174f2968ada Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 15 Jun 2017 05:44:07 +0900 Subject: Prevent extra `sync_with_transaction_state` `sync_with_transaction_state` in `to_key` is unneeded because `id` also does. --- activerecord/lib/active_record/attribute_methods/primary_key.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/attribute_methods/primary_key.rb b/activerecord/lib/active_record/attribute_methods/primary_key.rb index b5fd0cb370..b9b2acff37 100644 --- a/activerecord/lib/active_record/attribute_methods/primary_key.rb +++ b/activerecord/lib/active_record/attribute_methods/primary_key.rb @@ -8,17 +8,14 @@ module ActiveRecord # Returns this record's primary key value wrapped in an array if one is # available. def to_key - sync_with_transaction_state key = id [key] if key end # Returns the primary key value. def id - if pk = self.class.primary_key - sync_with_transaction_state - _read_attribute(pk) - end + sync_with_transaction_state + _read_attribute(self.class.primary_key) if self.class.primary_key end # Sets the primary key value. -- cgit v1.2.3 From 249fcbec4aa64a5f9e9f1671bf9180db4ebf9a37 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 15 Jun 2017 06:30:55 +0900 Subject: Add test cases for #28274 `object.id` is correctly restored since #29378 has merged. Closes #28274, Closes #28395. [Ryuta Kamizono & Eugene Kenny] --- activerecord/test/cases/transactions_test.rb | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'activerecord') diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index 5c6d78b574..79ba306ef5 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -595,6 +595,52 @@ class TransactionTest < ActiveRecord::TestCase assert_not topic.frozen? end + def test_restore_id_after_rollback + topic = Topic.new + + Topic.transaction do + topic.save! + raise ActiveRecord::Rollback + end + + assert_nil topic.id + end + + def test_restore_custom_primary_key_after_rollback + movie = Movie.new(name: "foo") + + Movie.transaction do + movie.save! + raise ActiveRecord::Rollback + end + + assert_nil movie.id + end + + def test_assign_id_after_rollback + topic = Topic.create! + + Topic.transaction do + topic.save! + raise ActiveRecord::Rollback + end + + topic.id = nil + assert_nil topic.id + end + + def test_assign_custom_primary_key_after_rollback + movie = Movie.create!(name: "foo") + + Movie.transaction do + movie.save! + raise ActiveRecord::Rollback + end + + movie.id = nil + assert_nil movie.id + end + def test_rollback_of_frozen_records topic = Topic.create.freeze Topic.transaction do -- cgit v1.2.3 From 9276ebc773d3287a9fa8d1c6ce9e3a14ceeb8add Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 15 Jun 2017 07:33:20 +0900 Subject: Fix `Relation#exists?` queries with query cache If a connection adapter overrides `select_*` methods, query caching will doesn't work. This patch changes `select_value` to `select_one` in `Relation#exists?` to ensure query caching. Fixes #29449. --- activerecord/lib/active_record/relation/finder_methods.rb | 2 +- activerecord/test/cases/query_cache_test.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 1d661fa8ed..0a339f8756 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -316,7 +316,7 @@ module ActiveRecord relation = construct_relation_for_exists(relation, conditions) - connection.select_value(relation, "#{name} Exists", relation.bound_attributes) ? true : false + connection.select_one(relation.arel, "#{name} Exists", relation.bound_attributes) ? true : false rescue ::RangeError false end diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb index 494663eb04..d75ec72b03 100644 --- a/activerecord/test/cases/query_cache_test.rb +++ b/activerecord/test/cases/query_cache_test.rb @@ -204,6 +204,12 @@ class QueryCacheTest < ActiveRecord::TestCase end end + def test_exists_queries_with_cache + Post.cache do + assert_queries(1) { Post.exists?; Post.exists? } + end + end + def test_query_cache_dups_results_correctly Task.cache do now = Time.now.utc -- cgit v1.2.3 From 951aa8da2f484cb4324b3501481ce178948bcd43 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 15 Jun 2017 18:27:00 +0900 Subject: Ensure query caching for `select_*` methods in connection adapters --- .../mysql/database_statements.rb | 19 ---------- .../postgresql/database_statements.rb | 32 ----------------- .../lib/active_record/relation/finder_methods.rb | 2 +- activerecord/test/cases/query_cache_test.rb | 40 ++++++++++++++++++++++ 4 files changed, 41 insertions(+), 52 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb index 8c67a7a80b..9f1021456b 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb @@ -13,15 +13,6 @@ module ActiveRecord result end - # Returns an array of arrays containing the field values. - # Order is the same as that returned by +columns+. - def select_rows(arel, name = nil, binds = []) # :nodoc: - select_result(arel, name, binds) do |result| - @connection.next_result while @connection.more_results? - result.to_a - end - end - # Executes the SQL statement in the context of this connection. def execute(sql, name = nil) # make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been @@ -58,16 +49,6 @@ module ActiveRecord @connection.last_id end - def select_result(arel, name, binds) - arel, binds = binds_from_relation(arel, binds) - sql = to_sql(arel, binds) - if without_prepared_statement?(binds) - execute_and_free(sql, name) { |result| yield result } - else - exec_stmt_and_free(sql, name, binds, cache_stmt: true) { |_, result| yield result } - end - end - def exec_stmt_and_free(sql, name, binds, cache_stmt: false) # make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been # made since we established the connection diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb index 705e6063dc..ac5efbebeb 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb @@ -7,30 +7,6 @@ module ActiveRecord PostgreSQL::ExplainPrettyPrinter.new.pp(exec_query(sql, "EXPLAIN", binds)) end - def select_value(arel, name = nil, binds = []) # :nodoc: - select_result(arel, name, binds) do |result| - result.getvalue(0, 0) if result.ntuples > 0 && result.nfields > 0 - end - end - - def select_values(arel, name = nil, binds = []) # :nodoc: - select_result(arel, name, binds) do |result| - if result.nfields > 0 - result.column_values(0) - else - [] - end - end - end - - # Executes a SELECT query and returns an array of rows. Each row is an - # array of field values. - def select_rows(arel, name = nil, binds = []) # :nodoc: - select_result(arel, name, binds) do |result| - result.values - end - end - # The internal PostgreSQL identifier of the money data type. MONEY_COLUMN_TYPE_OID = 790 #:nodoc: # The internal PostgreSQL identifier of the BYTEA data type. @@ -175,14 +151,6 @@ module ActiveRecord def suppress_composite_primary_key(pk) pk unless pk.is_a?(Array) end - - def select_result(arel, name, binds) - arel, binds = binds_from_relation(arel, binds) - sql = to_sql(arel, binds) - execute_and_clear(sql, name, binds) do |result| - yield result - end - end end end end diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 0a339f8756..1d661fa8ed 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -316,7 +316,7 @@ module ActiveRecord relation = construct_relation_for_exists(relation, conditions) - connection.select_one(relation.arel, "#{name} Exists", relation.bound_attributes) ? true : false + connection.select_value(relation, "#{name} Exists", relation.bound_attributes) ? true : false rescue ::RangeError false end diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb index d75ec72b03..9b741545d7 100644 --- a/activerecord/test/cases/query_cache_test.rb +++ b/activerecord/test/cases/query_cache_test.rb @@ -210,6 +210,46 @@ class QueryCacheTest < ActiveRecord::TestCase end end + def test_select_all_with_cache + Post.cache do + assert_queries(1) do + 2.times { Post.connection.select_all(Post.all) } + end + end + end + + def test_select_one_with_cache + Post.cache do + assert_queries(1) do + 2.times { Post.connection.select_one(Post.all) } + end + end + end + + def test_select_value_with_cache + Post.cache do + assert_queries(1) do + 2.times { Post.connection.select_value(Post.all) } + end + end + end + + def test_select_values_with_cache + Post.cache do + assert_queries(1) do + 2.times { Post.connection.select_values(Post.all) } + end + end + end + + def test_select_rows_with_cache + Post.cache do + assert_queries(1) do + 2.times { Post.connection.select_rows(Post.all) } + end + end + end + def test_query_cache_dups_results_correctly Task.cache do now = Time.now.utc -- cgit v1.2.3 From d9496c19c07d56bb200acd7312bf5d6355d515f4 Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Thu, 15 Jun 2017 15:51:44 +0530 Subject: Remove deprecated option from docs [ci skip] (#29459) --- activerecord/lib/active_record/associations.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 7c37132d3a..f05a122544 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -342,7 +342,7 @@ module ActiveRecord # | | belongs_to | # generated methods | belongs_to | :polymorphic | has_one # ----------------------------------+------------+--------------+--------- - # other(force_reload=false) | X | X | X + # other | X | X | X # other=(other) | X | X | X # build_other(attributes={}) | X | | X # create_other(attributes={}) | X | | X @@ -352,7 +352,7 @@ module ActiveRecord # | | | has_many # generated methods | habtm | has_many | :through # ----------------------------------+-------+----------+---------- - # others(force_reload=false) | X | X | X + # others | X | X | X # others=(other,other,...) | X | X | X # other_ids | X | X | X # other_ids=(id,id,...) | X | X | X @@ -1187,7 +1187,7 @@ module ActiveRecord # +collection+ is a placeholder for the symbol passed as the +name+ argument, so # has_many :clients would add among others clients.empty?. # - # [collection(force_reload = false)] + # [collection] # Returns an array of all the associated objects. # An empty array is returned if none are found. # [collection<<(object, ...)] @@ -1407,7 +1407,7 @@ module ActiveRecord # +association+ is a placeholder for the symbol passed as the +name+ argument, so # has_one :manager would add among others manager.nil?. # - # [association(force_reload = false)] + # [association] # Returns the associated object. +nil+ is returned if none is found. # [association=(associate)] # Assigns the associate object, extracts the primary key, sets it as the foreign key, @@ -1539,7 +1539,7 @@ module ActiveRecord # +association+ is a placeholder for the symbol passed as the +name+ argument, so # belongs_to :author would add among others author.nil?. # - # [association(force_reload = false)] + # [association] # Returns the associated object. +nil+ is returned if none is found. # [association=(associate)] # Assigns the associate object, extracts the primary key, and sets it as the foreign key. @@ -1701,7 +1701,7 @@ module ActiveRecord # +collection+ is a placeholder for the symbol passed as the +name+ argument, so # has_and_belongs_to_many :categories would add among others categories.empty?. # - # [collection(force_reload = false)] + # [collection] # Returns an array of all the associated objects. # An empty array is returned if none are found. # [collection<<(object, ...)] -- cgit v1.2.3 From 532125abb4b68fee38e642e0b1c155aabfb58f0e Mon Sep 17 00:00:00 2001 From: Dan Sherson Date: Thu, 15 Jun 2017 20:29:30 +1000 Subject: Don't require 'unscope' to be the same for both sides of a 'or' relation. --- .../lib/active_record/relation/query_methods.rb | 2 +- activerecord/test/cases/relation/or_test.rb | 25 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 79e65baae5..6ccdd7adcb 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -1167,7 +1167,7 @@ module ActiveRecord end end - STRUCTURAL_OR_METHODS = Relation::VALUE_METHODS - [:extending, :where, :having] + STRUCTURAL_OR_METHODS = Relation::VALUE_METHODS - [:extending, :where, :having, :unscope] def structurally_incompatible_values_for_or(other) STRUCTURAL_OR_METHODS.reject do |method| get_value(method) == other.get_value(method) diff --git a/activerecord/test/cases/relation/or_test.rb b/activerecord/test/cases/relation/or_test.rb index abb7ca72dd..61b6601580 100644 --- a/activerecord/test/cases/relation/or_test.rb +++ b/activerecord/test/cases/relation/or_test.rb @@ -59,6 +59,31 @@ module ActiveRecord assert_equal "Relation passed to #or must be structurally compatible. Incompatible values: [:order]", error.message end + def test_or_with_unscope_where + expected = Post.where("id = 1 or id = 2") + partial = Post.where("id = 1 and id != 2") + assert_equal expected, partial.or(partial.unscope(:where).where("id = 2")).to_a + end + + def test_or_with_unscope_where_column + expected = Post.where("id = 1 or id = 2") + partial = Post.where(id: 1).where.not(id: 2) + assert_equal expected, partial.or(partial.unscope(where: :id).where("id = 2")).to_a + end + + def test_or_with_unscope_order + expected = Post.where("id = 1 or id = 2") + assert_equal expected, Post.order("body asc").where("id = 1").unscope(:order).or(Post.where("id = 2")).to_a + end + + def test_or_with_incompatible_unscope + error = assert_raises ArgumentError do + Post.order("body asc").where("id = 1").or(Post.order("body asc").where("id = 2").unscope(:order)).to_a + end + + assert_equal "Relation passed to #or must be structurally compatible. Incompatible values: [:order]", error.message + end + def test_or_when_grouping groups = Post.where("id < 10").group("body").select("body, COUNT(*) AS c") expected = groups.having("COUNT(*) > 1 OR body like 'Such%'").to_a.map { |o| [o.body, o.c] } -- cgit v1.2.3 From 28b54c6b479dde42d08dbfd9faa2e5fbfcadf86f Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 15 Jun 2017 19:50:05 +0900 Subject: Fix `dump_schema_information` with empty versions Fixes #29460. --- .../active_record/connection_adapters/abstract/schema_statements.rb | 2 +- activerecord/test/cases/schema_dumper_test.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'activerecord') 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 a1031ccbf5..22d7791dec 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -1010,7 +1010,7 @@ module ActiveRecord def dump_schema_information #:nodoc: versions = ActiveRecord::SchemaMigration.all_versions - insert_versions_sql(versions) + insert_versions_sql(versions) if versions.any? end def initialize_schema_migrations_table # :nodoc: diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb index b5386ba801..4c81e825fa 100644 --- a/activerecord/test/cases/schema_dumper_test.rb +++ b/activerecord/test/cases/schema_dumper_test.rb @@ -17,6 +17,12 @@ class SchemaDumperTest < ActiveRecord::TestCase dump_all_table_schema [] end + def test_dump_schema_information_with_empty_versions + ActiveRecord::SchemaMigration.delete_all + schema_info = ActiveRecord::Base.connection.dump_schema_information + assert_no_match(/INSERT INTO/, schema_info) + end + def test_dump_schema_information_outputs_lexically_ordered_versions versions = %w{ 20100101010101 20100201010101 20100301010101 } versions.reverse_each do |v| -- cgit v1.2.3 From 2e4fe3a4ada95d08a77ff4df5cbf49ada0a10f6d Mon Sep 17 00:00:00 2001 From: Eugene Kenny Date: Thu, 15 Jun 2017 13:00:20 +0100 Subject: Don't map id to primary key in raw_write_attribute The `raw_write_attribute` method is used to update a record's attributes to reflect the new state of the database in `update_columns`. The hash provided to `update_columns` is turned into an UPDATE query directly, which means passing an `id` key results in an update to the `id` column, even if the model uses a different attribute as its primary key. When updating the record, we don't want to apply the `id` column change to the primary key attribute, since that's not what happened in the query. Without the code to handle this case, `write_attribute_with_type_cast` no longer contains any logic shared between `raw_write_attribute` and `write_attribute`, so we can inline the code into those two methods. --- .../lib/active_record/attribute_methods/write.rb | 21 ++++++--------------- activerecord/test/cases/primary_keys_test.rb | 6 ++++++ 2 files changed, 12 insertions(+), 15 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/attribute_methods/write.rb b/activerecord/lib/active_record/attribute_methods/write.rb index fe0e01db28..75c5a1a600 100644 --- a/activerecord/lib/active_record/attribute_methods/write.rb +++ b/activerecord/lib/active_record/attribute_methods/write.rb @@ -35,11 +35,15 @@ module ActiveRecord attr_name.to_s end - write_attribute_with_type_cast(name, value, true) + name = self.class.primary_key if name == "id".freeze && self.class.primary_key + @attributes.write_from_user(name, value) + value end def raw_write_attribute(attr_name, value) # :nodoc: - write_attribute_with_type_cast(attr_name, value, false) + name = attr_name.to_s + @attributes.write_cast_value(name, value) + value end private @@ -47,19 +51,6 @@ module ActiveRecord def attribute=(attribute_name, value) write_attribute(attribute_name, value) end - - def write_attribute_with_type_cast(attr_name, value, should_type_cast) - attr_name = attr_name.to_s - attr_name = self.class.primary_key if attr_name == "id" && self.class.primary_key - - if should_type_cast - @attributes.write_from_user(attr_name, value) - else - @attributes.write_cast_value(attr_name, value) - end - - value - end end end end diff --git a/activerecord/test/cases/primary_keys_test.rb b/activerecord/test/cases/primary_keys_test.rb index 200d9e6434..56229b70bc 100644 --- a/activerecord/test/cases/primary_keys_test.rb +++ b/activerecord/test/cases/primary_keys_test.rb @@ -80,6 +80,12 @@ class PrimaryKeysTest < ActiveRecord::TestCase assert_equal 1, subscriber.update_count end + def test_update_columns_with_non_primary_key_id_column + subscriber = Subscriber.first + subscriber.update_columns(id: 1) + assert_not_equal 1, subscriber.nick + end + def test_string_key subscriber = Subscriber.find(subscribers(:first).nick) assert_equal(subscribers(:first).name, subscriber.name) -- cgit v1.2.3 From 5409e5e31b00f05d4e706d2086a3205974a25886 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Fri, 16 Jun 2017 09:47:57 +0900 Subject: Use nullable `id` column instead of a primary key `id` column in `subscribers` was added as a primary key for ignorable in INSERT. But it caused `NotNullViolation` for oracle-enhanced adapter. https://github.com/rsim/oracle-enhanced/issues/1357 I changed the column to nullable to address the issue. --- activerecord/test/schema/schema.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index 8863736943..dc8bdb98ff 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -814,9 +814,10 @@ ActiveRecord::Schema.define do t.index :id, unique: true end - create_table :subscribers, force: true do |t| + create_table :subscribers, id: false, force: true do |t| t.string :nick, null: false t.string :name + t.integer :id t.integer :books_count, null: false, default: 0 t.integer :update_count, null: false, default: 0 t.index :nick, unique: true -- cgit v1.2.3 From 675a912eb86a9e109e9877379e8454b388242d57 Mon Sep 17 00:00:00 2001 From: Kir Shatrov Date: Wed, 14 Jun 2017 22:39:19 -0400 Subject: Remove FK together with column in MySQL Unlike with other databses, MySQL doesn't let you remove the column if there's a FK on this column. For better developer experience we want to remove the FK together with the column. --- .../connection_adapters/mysql/schema_statements.rb | 7 +++++++ .../test/cases/migration/references_foreign_key_test.rb | 10 ++++++++++ 2 files changed, 17 insertions(+) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb index f9e1e046ea..fc57e41fc9 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb @@ -45,6 +45,13 @@ module ActiveRecord indexes end + def remove_column(table_name, column_name, type = nil, options = {}) + if foreign_key_exists?(table_name, column: column_name) + remove_foreign_key(table_name, column: column_name) + end + super + end + def internal_string_options_for_primary_key super.tap do |options| if CHARSETS_OF_4BYTES_MAXLEN.include?(charset) && (mariadb? || version < "8.0.0") diff --git a/activerecord/test/cases/migration/references_foreign_key_test.rb b/activerecord/test/cases/migration/references_foreign_key_test.rb index f1ddac1ee2..718b9a0613 100644 --- a/activerecord/test/cases/migration/references_foreign_key_test.rb +++ b/activerecord/test/cases/migration/references_foreign_key_test.rb @@ -139,6 +139,16 @@ if ActiveRecord::Base.connection.supports_foreign_keys? end end + test "removing column removes foreign key" do + @connection.create_table :testings do |t| + t.references :testing_parent, index: true, foreign_key: true + end + + assert_difference "@connection.foreign_keys('testings').size", -1 do + @connection.remove_column :testings, :testing_parent_id + end + end + test "foreign key methods respect pluralize_table_names" do begin original_pluralize_table_names = ActiveRecord::Base.pluralize_table_names -- cgit v1.2.3 From bd4f28a46dc3cafd00aabd7c7e6540b3d48593b2 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 18 Jun 2017 13:32:49 +0900 Subject: Add a test case for #28754 A part for JSON was splitted from #28416 as #29273 and #29273 has already been merged. Closes #28754. Closes #27588. [Ryuta Kamizono & Bradley Priest] --- activerecord/test/cases/json_shared_test_cases.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'activerecord') diff --git a/activerecord/test/cases/json_shared_test_cases.rb b/activerecord/test/cases/json_shared_test_cases.rb index 5aa41b9d6d..9a1c1c3f3f 100644 --- a/activerecord/test/cases/json_shared_test_cases.rb +++ b/activerecord/test/cases/json_shared_test_cases.rb @@ -169,6 +169,25 @@ module JSONSharedTestCases assert_not json.changed? end + def test_changes_in_place_ignores_key_order + json = klass.new + assert_not json.changed? + + json.payload = { "three" => "four", "one" => "two" } + json.save! + json.reload + + json.payload = { "three" => "four", "one" => "two" } + assert_not json.changed? + + json.payload = [{ "three" => "four", "one" => "two" }, { "seven" => "eight", "five" => "six" }] + json.save! + json.reload + + json.payload = [{ "three" => "four", "one" => "two" }, { "seven" => "eight", "five" => "six" }] + assert_not json.changed? + end + def test_changes_in_place_with_ruby_object time = Time.now.utc json = klass.create!(payload: time) -- cgit v1.2.3 From 542f92935cdc1b23078364e547f923ec180e7efe Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 18 Jun 2017 14:16:23 +0900 Subject: Remove debug print This debug print was added in 87f5e5e for finding the regression caused by d314646 and the regression has already been fixed in 969339b. --- activerecord/test/cases/connection_pool_test.rb | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/connection_pool_test.rb b/activerecord/test/cases/connection_pool_test.rb index 7e88c9cf7a..00a0187b57 100644 --- a/activerecord/test/cases/connection_pool_test.rb +++ b/activerecord/test/cases/connection_pool_test.rb @@ -499,21 +499,8 @@ module ActiveRecord if failed second_thread_done.set - puts - puts ">>> test_disconnect_and_clear_reloadable_connections_are_able_to_preempt_other_waiting_threads / #{group_action_method}" - p [first_thread, second_thread] - p pool.stat - p pool.connections.map(&:owner) - first_thread.join(2) second_thread.join(2) - - puts "---" - p [first_thread, second_thread] - p pool.stat - p pool.connections.map(&:owner) - puts "<<<" - puts end first_thread.join(10) || raise("first_thread got stuck") -- cgit v1.2.3 From 95a91f392242d5cfcf3fb38b66c5645ceae009b8 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 18 Jun 2017 19:59:09 +0900 Subject: Prevent extra `scope` construction in `find_target` Because constructing `scope` is a little expensive. --- activerecord/lib/active_record/associations/association.rb | 2 +- activerecord/lib/active_record/associations/collection_association.rb | 3 ++- activerecord/lib/active_record/associations/singular_association.rb | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb index ee2e79889f..5c45187d8f 100644 --- a/activerecord/lib/active_record/associations/association.rb +++ b/activerecord/lib/active_record/associations/association.rb @@ -276,7 +276,7 @@ module ActiveRecord end # Returns true if statement cache should be skipped on the association reader. - def skip_statement_cache? + def skip_statement_cache?(scope) reflection.has_scope? || scope.eager_loading? || klass.scope_attributes? || diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index edc53e2517..0cb17b47e8 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -300,7 +300,8 @@ module ActiveRecord private def find_target - return scope.to_a if skip_statement_cache? + scope = self.scope + return scope.to_a if skip_statement_cache?(scope) conn = klass.connection sc = reflection.association_scope_cache(conn, owner) do diff --git a/activerecord/lib/active_record/associations/singular_association.rb b/activerecord/lib/active_record/associations/singular_association.rb index ca138635d2..2b426da607 100644 --- a/activerecord/lib/active_record/associations/singular_association.rb +++ b/activerecord/lib/active_record/associations/singular_association.rb @@ -36,7 +36,8 @@ module ActiveRecord end def find_target - return scope.take if skip_statement_cache? + scope = self.scope + return scope.take if skip_statement_cache?(scope) conn = klass.connection sc = reflection.association_scope_cache(conn, owner) do -- cgit v1.2.3 From c879649a733d982fba9e70f5a280d13636b67c37 Mon Sep 17 00:00:00 2001 From: Eugene Kenny Date: Sun, 18 Jun 2017 15:37:06 +0100 Subject: Improve the performance of writing attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using a similar approach to 08576b94ad4f19dfc368619d7751e211d23dcad8, this change adds a new internal `_write_attribute` method which bypasses the code that checks for attribute aliases and custom primary keys. We can use this method instead of `write_attribute` when we know that we have the name of the actual column to be updated and not an alias. This makes writing an attribute with `attribute=` about 18% faster. Benchmark: ``` begin require "bundler/inline" rescue LoadError => e $stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" raise e end gemfile(true) do source "https://rubygems.org" gem "rails", github: "rails/rails" gem "arel", github: "rails/arel" gem "sqlite3" gem "benchmark-ips" end require "active_record" ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:") ActiveRecord::Schema.define do create_table :posts, force: true do |t| end end class Post < ActiveRecord::Base end post = Post.new(id: 1) Benchmark.ips do |x| x.report("attribute=") { post.id = post.id + 1 } end ``` Before: Warming up -------------------------------------- attribute= 25.889k i/100ms Calculating ------------------------------------- attribute= 290.946k (± 3.1%) i/s - 1.476M in 5.077036s After: Warming up -------------------------------------- attribute= 30.056k i/100ms Calculating ------------------------------------- attribute= 345.088k (± 4.8%) i/s - 1.743M in 5.064264s --- .../lib/active_record/attribute_methods/primary_key.rb | 2 +- activerecord/lib/active_record/attribute_methods/write.rb | 14 ++++++++++---- activerecord/lib/active_record/inheritance.rb | 2 +- activerecord/lib/active_record/timestamp.rb | 4 ++-- 4 files changed, 14 insertions(+), 8 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/attribute_methods/primary_key.rb b/activerecord/lib/active_record/attribute_methods/primary_key.rb index b9b2acff37..081aad434d 100644 --- a/activerecord/lib/active_record/attribute_methods/primary_key.rb +++ b/activerecord/lib/active_record/attribute_methods/primary_key.rb @@ -21,7 +21,7 @@ module ActiveRecord # Sets the primary key value. def id=(value) sync_with_transaction_state - write_attribute(self.class.primary_key, value) if self.class.primary_key + _write_attribute(self.class.primary_key, value) if self.class.primary_key end # Queries the primary key value. diff --git a/activerecord/lib/active_record/attribute_methods/write.rb b/activerecord/lib/active_record/attribute_methods/write.rb index 75c5a1a600..d7ddd35dff 100644 --- a/activerecord/lib/active_record/attribute_methods/write.rb +++ b/activerecord/lib/active_record/attribute_methods/write.rb @@ -17,7 +17,7 @@ module ActiveRecord 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) + _write_attribute(name, value) end alias_method #{(name + '=').inspect}, :__temp__#{safe_name}= undef_method :__temp__#{safe_name}= @@ -36,8 +36,7 @@ module ActiveRecord end name = self.class.primary_key if name == "id".freeze && self.class.primary_key - @attributes.write_from_user(name, value) - value + _write_attribute(name, value) end def raw_write_attribute(attr_name, value) # :nodoc: @@ -46,10 +45,17 @@ module ActiveRecord value end + # This method exists to avoid the expensive primary_key check internally, without + # breaking compatibility with the write_attribute API + def _write_attribute(attr_name, value) # :nodoc: + @attributes.write_from_user(attr_name.to_s, value) + value + end + private # Handle *= for method_missing. def attribute=(attribute_name, value) - write_attribute(attribute_name, value) + _write_attribute(attribute_name, value) end end end diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb index 5776807507..1753322274 100644 --- a/activerecord/lib/active_record/inheritance.rb +++ b/activerecord/lib/active_record/inheritance.rb @@ -245,7 +245,7 @@ module ActiveRecord def ensure_proper_type klass = self.class if klass.finder_needs_type_condition? - write_attribute(klass.inheritance_column, klass.sti_name) + _write_attribute(klass.inheritance_column, klass.sti_name) end end end diff --git a/activerecord/lib/active_record/timestamp.rb b/activerecord/lib/active_record/timestamp.rb index 55f3a194a9..ae50bc6bc1 100644 --- a/activerecord/lib/active_record/timestamp.rb +++ b/activerecord/lib/active_record/timestamp.rb @@ -86,7 +86,7 @@ module ActiveRecord all_timestamp_attributes_in_model.each do |column| if !attribute_present?(column) - write_attribute(column, current_time) + _write_attribute(column, current_time) end end end @@ -100,7 +100,7 @@ module ActiveRecord timestamp_attributes_for_update_in_model.each do |column| next if will_save_change_to_attribute?(column) - write_attribute(column, current_time) + _write_attribute(column, current_time) end end super(*args) -- cgit v1.2.3 From 67ad6bb3be4d9a1b335cffee351e9750aa572aab Mon Sep 17 00:00:00 2001 From: Kir Shatrov Date: Fri, 16 Jun 2017 21:27:20 -0400 Subject: Refactor #insert_fixtures to use Arel --- .../connection_adapters/abstract/database_statements.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index c6811a4802..56f0d6d1f4 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -308,16 +308,23 @@ module ActiveRecord raise Fixture::FixtureError, %(table "#{table_name}" has no column named #{name.inspect}.) end end - key_list = fixture.keys.map { |name| quote_column_name(name) } - value_list = binds.map(&:value_for_database).map do |value| + + table = Arel::Table.new(table_name) + + values = binds.map do |bind| + value = bind.value_for_database begin quote(value) rescue TypeError - quote(YAML.dump(value)) + value = YAML.dump(value) end + [table[bind.name], value] end - execute "INSERT INTO #{quote_table_name(table_name)} (#{key_list.join(', ')}) VALUES (#{value_list.join(', ')})", "Fixture Insert" + manager = Arel::InsertManager.new + manager.into(table) + manager.insert(values) + execute manager.to_sql, "Fixture Insert" end def empty_insert_statement_value -- cgit v1.2.3 From 686e8fb52e00b24bd3a334cd7748df950914bfbf Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sat, 10 Jun 2017 19:13:30 +0900 Subject: `Relation#locked?` should not build arel --- activerecord/lib/active_record/relation.rb | 2 +- activerecord/test/cases/relations_test.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 7a8f9abb36..133c1a6318 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -18,7 +18,7 @@ module ActiveRecord attr_reader :table, :klass, :loaded, :predicate_builder alias :model :klass alias :loaded? :loaded - alias :locked? :locked + alias :locked? :lock_value def initialize(klass, table, predicate_builder, values = {}) @klass = klass diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 86f3b0b962..5f36e4ec5d 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -2001,6 +2001,12 @@ class RelationTest < ActiveRecord::TestCase assert_equal binds, merged.bound_attributes end + def test_locked_should_not_build_arel + posts = Post.lock + assert posts.locked? + assert_nothing_raised { posts.lock!(false) } + end + def test_relation_join_method assert_equal "Thank you for the welcome,Thank you again for the welcome", Post.first.comments.join(",") end -- cgit v1.2.3 From b86e313df53ada181850a057e254052f38014738 Mon Sep 17 00:00:00 2001 From: Pat Allan Date: Tue, 20 Jun 2017 19:43:21 +1000 Subject: Make ActiveRecord frozen string literal friendly. --- activerecord/lib/active_record/associations/join_dependency.rb | 3 +-- .../connection_adapters/abstract/connection_pool.rb | 2 +- .../connection_adapters/abstract/schema_creation.rb | 8 ++++---- .../connection_adapters/abstract/schema_statements.rb | 2 +- .../lib/active_record/connection_adapters/abstract_adapter.rb | 2 +- .../connection_adapters/abstract_mysql_adapter.rb | 8 ++++---- .../active_record/connection_adapters/mysql/schema_creation.rb | 4 ++-- .../connection_adapters/mysql/schema_statements.rb | 2 +- .../connection_adapters/postgresql/schema_statements.rb | 6 +++--- .../connection_adapters/sqlite3/schema_statements.rb | 2 +- activerecord/lib/active_record/explain.rb | 2 +- activerecord/lib/active_record/migration.rb | 6 +++--- activerecord/lib/active_record/relation/finder_methods.rb | 4 ++-- activerecord/lib/active_record/tasks/mysql_database_tasks.rb | 2 +- activerecord/test/cases/adapters/postgresql/bytea_test.rb | 2 +- activerecord/test/cases/adapters/postgresql/money_test.rb | 10 +++++----- .../test/cases/adapters/sqlite3/sqlite3_adapter_test.rb | 4 ++-- activerecord/test/cases/attribute_test.rb | 4 ++-- activerecord/test/cases/batches_test.rb | 4 ++-- activerecord/test/cases/binary_test.rb | 2 +- activerecord/test/cases/core_test.rb | 8 ++++---- 21 files changed, 43 insertions(+), 44 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index 643226267c..dfe8f221d8 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -197,8 +197,7 @@ module ActiveRecord def table_alias_for(reflection, parent, join) name = "#{reflection.plural_name}_#{parent.table_name}" - name << "_join" if join - name + join ? "#{name}_join" : name end def walk(left, right) diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index 61bf5477aa..627b753f01 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -679,7 +679,7 @@ module ActiveRecord # this block can't be easily moved into attempt_to_checkout_all_existing_connections's # rescue block, because doing so would put it outside of synchronize section, without # being in a critical section thread_report might become inaccurate - msg = "could not obtain ownership of all database connections in #{checkout_timeout} seconds" + msg = "could not obtain ownership of all database connections in #{checkout_timeout} seconds".dup thread_report = [] @connections.each do |conn| diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb index 93f4529202..8865e7c703 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb @@ -22,7 +22,7 @@ module ActiveRecord private def visit_AlterTable(o) - sql = "ALTER TABLE #{quote_table_name(o.name)} " + sql = "ALTER TABLE #{quote_table_name(o.name)} ".dup sql << o.adds.map { |col| accept col }.join(" ") sql << o.foreign_key_adds.map { |fk| visit_AddForeignKey fk }.join(" ") sql << o.foreign_key_drops.map { |fk| visit_DropForeignKey fk }.join(" ") @@ -30,17 +30,17 @@ module ActiveRecord def visit_ColumnDefinition(o) o.sql_type = type_to_sql(o.type, o.options) - column_sql = "#{quote_column_name(o.name)} #{o.sql_type}" + column_sql = "#{quote_column_name(o.name)} #{o.sql_type}".dup add_column_options!(column_sql, column_options(o)) unless o.type == :primary_key column_sql end def visit_AddColumnDefinition(o) - "ADD #{accept(o.column)}" + "ADD #{accept(o.column)}".dup end def visit_TableDefinition(o) - create_sql = "CREATE#{' TEMPORARY' if o.temporary} TABLE #{quote_table_name(o.name)} " + create_sql = "CREATE#{' TEMPORARY' if o.temporary} TABLE #{quote_table_name(o.name)} ".dup statements = o.columns.map { |c| accept c } statements << accept(o.primary_keys) if o.primary_keys 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 22d7791dec..9bcd1e85f7 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -1348,7 +1348,7 @@ module ActiveRecord sm_table = quote_table_name(ActiveRecord::SchemaMigration.table_name) if versions.is_a?(Array) - sql = "INSERT INTO #{sm_table} (version) VALUES\n" + sql = "INSERT INTO #{sm_table} (version) VALUES\n".dup sql << versions.map { |v| "(#{quote(v)})" }.join(",\n") sql << ";\n\n" sql diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 85d6fbe8b3..9a085df934 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -147,7 +147,7 @@ module ActiveRecord # this method must only be called while holding connection pool's mutex def lease if in_use? - msg = "Cannot lease connection, " + msg = "Cannot lease connection, ".dup if @owner == Thread.current msg << "it is already leased by the current thread." else diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index 648c869915..ca20ef89da 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -132,7 +132,7 @@ module ActiveRecord end def index_algorithms - { default: "ALGORITHM = DEFAULT", copy: "ALGORITHM = COPY", inplace: "ALGORITHM = INPLACE" } + { default: "ALGORITHM = DEFAULT".dup, copy: "ALGORITHM = COPY".dup, inplace: "ALGORITHM = INPLACE".dup } end # HELPER METHODS =========================================== @@ -379,7 +379,7 @@ module ActiveRecord def add_index(table_name, column_name, options = {}) #:nodoc: index_name, index_type, index_columns, _, index_algorithm, index_using, comment = add_index_options(table_name, column_name, options) - sql = "CREATE #{index_type} INDEX #{quote_column_name(index_name)} #{index_using} ON #{quote_table_name(table_name)} (#{index_columns}) #{index_algorithm}" + sql = "CREATE #{index_type} INDEX #{quote_column_name(index_name)} #{index_using} ON #{quote_table_name(table_name)} (#{index_columns}) #{index_algorithm}".dup execute add_sql_comment!(sql, comment) end @@ -464,7 +464,7 @@ module ActiveRecord super end - sql << " unsigned" if unsigned && type != :primary_key + sql = "#{sql} unsigned" if unsigned && type != :primary_key sql end @@ -761,7 +761,7 @@ module ActiveRecord # http://dev.mysql.com/doc/refman/5.7/en/set-statement.html#id944430 # (trailing comma because variable_assignments will always have content) if @config[:encoding] - encoding = "NAMES #{@config[:encoding]}" + encoding = "NAMES #{@config[:encoding]}".dup encoding << " COLLATE #{@config[:collation]}" if @config[:collation] encoding << ", " end diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb index 083cd6340f..eea4984680 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb @@ -16,7 +16,7 @@ module ActiveRecord end def visit_ChangeColumnDefinition(o) - change_column_sql = "CHANGE #{quote_column_name(o.name)} #{accept(o.column)}" + change_column_sql = "CHANGE #{quote_column_name(o.name)} #{accept(o.column)}".dup add_column_position!(change_column_sql, column_options(o.column)) end @@ -63,7 +63,7 @@ module ActiveRecord def index_in_create(table_name, column_name, options) index_name, index_type, index_columns, _, _, index_using, comment = @conn.add_index_options(table_name, column_name, options) - add_sql_comment!("#{index_type} INDEX #{quote_column_name(index_name)} #{index_using} (#{index_columns})", comment) + add_sql_comment!("#{index_type} INDEX #{quote_column_name(index_name)} #{index_using} (#{index_columns})".dup, comment) end end end diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb index fc57e41fc9..a01fbba201 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb @@ -102,7 +102,7 @@ module ActiveRecord def data_source_sql(name = nil, type: nil) scope = quoted_scope(name, type: type) - sql = "SELECT table_name FROM information_schema.tables" + sql = "SELECT table_name FROM information_schema.tables".dup sql << " WHERE table_schema = #{scope[:schema]}" sql << " AND table_name = #{scope[:name]}" if scope[:name] sql << " AND table_type = #{scope[:type]}" if scope[:type] 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 cb45d7ba6b..0a614e133d 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb @@ -408,7 +408,7 @@ module ActiveRecord quoted_table_name = quote_table_name(table_name) quoted_column_name = quote_column_name(column_name) sql_type = type_to_sql(type, options) - sql = "ALTER TABLE #{quoted_table_name} ALTER COLUMN #{quoted_column_name} TYPE #{sql_type}" + sql = "ALTER TABLE #{quoted_table_name} ALTER COLUMN #{quoted_column_name} TYPE #{sql_type}".dup if options[:collation] sql << " COLLATE \"#{options[:collation]}\"" end @@ -568,7 +568,7 @@ module ActiveRecord super end - sql << "[]" if array && type != :primary_key + sql = "#{sql}[]" if array && type != :primary_key sql end @@ -637,7 +637,7 @@ module ActiveRecord scope = quoted_scope(name, type: type) scope[:type] ||= "'r','v','m'" # (r)elation/table, (v)iew, (m)aterialized view - sql = "SELECT c.relname FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace" + sql = "SELECT c.relname FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace".dup sql << " WHERE n.nspname = #{scope[:schema]}" sql << " AND c.relname = #{scope[:name]}" if scope[:name] sql << " AND c.relkind IN (#{scope[:type]})" diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb index e02491edb6..118f373bdc 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb @@ -67,7 +67,7 @@ module ActiveRecord scope = quoted_scope(name, type: type) scope[:type] ||= "'table','view'" - sql = "SELECT name FROM sqlite_master WHERE name <> 'sqlite_sequence'" + sql = "SELECT name FROM sqlite_master WHERE name <> 'sqlite_sequence'".dup sql << " AND name = #{scope[:name]}" if scope[:name] sql << " AND type IN (#{scope[:type]})" sql diff --git a/activerecord/lib/active_record/explain.rb b/activerecord/lib/active_record/explain.rb index 8f7ae2c33c..5e67d16e9f 100644 --- a/activerecord/lib/active_record/explain.rb +++ b/activerecord/lib/active_record/explain.rb @@ -16,7 +16,7 @@ module ActiveRecord # Returns a formatted string ready to be logged. def exec_explain(queries) # :nodoc: str = queries.map do |sql, binds| - msg = "EXPLAIN for: #{sql}" + msg = "EXPLAIN for: #{sql}".dup unless binds.empty? msg << " " msg << binds.map { |attr| render_bind(attr) }.inspect diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 51c82f4ced..1ff1dcad43 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -157,7 +157,7 @@ module ActiveRecord class ProtectedEnvironmentError < ActiveRecordError #:nodoc: def initialize(env = "production") - msg = "You are attempting to run a destructive action against your '#{env}' database.\n" + msg = "You are attempting to run a destructive action against your '#{env}' database.\n".dup msg << "If you are sure you want to continue, run the same command with the environment variable:\n" msg << "DISABLE_DATABASE_ENVIRONMENT_CHECK=1" super(msg) @@ -166,7 +166,7 @@ module ActiveRecord class EnvironmentMismatchError < ActiveRecordError def initialize(current: nil, stored: nil) - msg = "You are attempting to modify a database that was last run in `#{ stored }` environment.\n" + msg = "You are attempting to modify a database that was last run in `#{ stored }` environment.\n".dup msg << "You are running in `#{ current }` environment. " msg << "If you are sure you want to continue, first set the environment using:\n\n" msg << " bin/rails db:environment:set" @@ -1239,7 +1239,7 @@ module ActiveRecord record_version_state_after_migrating(migration.version) end rescue => e - msg = "An error has occurred, " + msg = "An error has occurred, ".dup msg << "this and " if use_transaction?(migration) msg << "all later migrations canceled:\n\n#{e}" raise StandardError, msg, e.backtrace diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 1d661fa8ed..3c848d3206 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -335,14 +335,14 @@ module ActiveRecord name = @klass.name if ids.nil? - error = "Couldn't find #{name}" + error = "Couldn't find #{name}".dup error << " with#{conditions}" if conditions raise RecordNotFound.new(error, name) elsif Array(ids).size == 1 error = "Couldn't find #{name} with '#{key}'=#{ids}#{conditions}" raise RecordNotFound.new(error, name, key, ids) else - error = "Couldn't find all #{name.pluralize} with '#{key}': " + error = "Couldn't find all #{name.pluralize} with '#{key}': ".dup error << "(#{ids.join(", ")})#{conditions} (found #{result_size} results, but was looking for #{expected_size})" raise RecordNotFound.new(error, name, primary_key, ids) diff --git a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb index 541165b3d1..fedc21010b 100644 --- a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb @@ -151,7 +151,7 @@ IDENTIFIED BY '#{configuration['password']}' WITH GRANT OPTION; end def run_cmd_error(cmd, args, action) - msg = "failed to execute: `#{cmd}`\n" + msg = "failed to execute: `#{cmd}`\n".dup msg << "Please check the output above for any errors and make sure that `#{cmd}` is installed in your PATH and has proper permissions.\n\n" msg end diff --git a/activerecord/test/cases/adapters/postgresql/bytea_test.rb b/activerecord/test/cases/adapters/postgresql/bytea_test.rb index 539c90f0bc..65baed34e9 100644 --- a/activerecord/test/cases/adapters/postgresql/bytea_test.rb +++ b/activerecord/test/cases/adapters/postgresql/bytea_test.rb @@ -47,7 +47,7 @@ class PostgresqlByteaTest < ActiveRecord::PostgreSQLTestCase end def test_type_cast_binary_value - data = "\u001F\x8B".force_encoding("BINARY") + data = "\u001F\x8B".dup.force_encoding("BINARY") assert_equal(data, @type.deserialize(data)) end diff --git a/activerecord/test/cases/adapters/postgresql/money_test.rb b/activerecord/test/cases/adapters/postgresql/money_test.rb index 1b5d8362af..ea060345a7 100644 --- a/activerecord/test/cases/adapters/postgresql/money_test.rb +++ b/activerecord/test/cases/adapters/postgresql/money_test.rb @@ -47,10 +47,10 @@ class PostgresqlMoneyTest < ActiveRecord::PostgreSQLTestCase def test_money_type_cast type = PostgresqlMoney.type_for_attribute("wealth") - assert_equal(12345678.12, type.cast("$12,345,678.12")) - assert_equal(12345678.12, type.cast("$12.345.678,12")) - assert_equal(-1.15, type.cast("-$1.15")) - assert_equal(-2.25, type.cast("($2.25)")) + assert_equal(12345678.12, type.cast("$12,345,678.12".dup)) + assert_equal(12345678.12, type.cast("$12.345.678,12".dup)) + assert_equal(-1.15, type.cast("-$1.15".dup)) + assert_equal(-2.25, type.cast("($2.25)".dup)) end def test_schema_dumping @@ -60,7 +60,7 @@ class PostgresqlMoneyTest < ActiveRecord::PostgreSQLTestCase end def test_create_and_update_money - money = PostgresqlMoney.create(wealth: "987.65") + money = PostgresqlMoney.create(wealth: "987.65".dup) assert_equal 987.65, money.wealth new_value = BigDecimal.new("123.45") diff --git a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb index 9a812e325e..cf0c37f70c 100644 --- a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb @@ -165,7 +165,7 @@ module ActiveRecord data binary ) eosql - str = "\x80".force_encoding("ASCII-8BIT") + str = "\x80".dup.force_encoding("ASCII-8BIT") binary = DualEncoding.new name: "いただきます!", data: str binary.save! assert_equal str, binary.data @@ -174,7 +174,7 @@ module ActiveRecord end def test_type_cast_should_not_mutate_encoding - name = "hello".force_encoding(Encoding::ASCII_8BIT) + name = "hello".dup.force_encoding(Encoding::ASCII_8BIT) Owner.create(name: name) assert_equal Encoding::ASCII_8BIT, name.encoding ensure diff --git a/activerecord/test/cases/attribute_test.rb b/activerecord/test/cases/attribute_test.rb index 7cf6b498c9..e856d551c0 100644 --- a/activerecord/test/cases/attribute_test.rb +++ b/activerecord/test/cases/attribute_test.rb @@ -76,7 +76,7 @@ module ActiveRecord end test "duping dups the value" do - @type.expect(:deserialize, "type cast", ["a value"]) + @type.expect(:deserialize, "type cast".dup, ["a value"]) attribute = Attribute.from_database(nil, "a value", @type) value_from_orig = attribute.value @@ -244,7 +244,7 @@ module ActiveRecord end test "with_type preserves mutations" do - attribute = Attribute.from_database(:foo, "", Type::Value.new) + attribute = Attribute.from_database(:foo, "".dup, Type::Value.new) attribute.value << "1" assert_equal 1, attribute.with_type(Type::Integer.new).value diff --git a/activerecord/test/cases/batches_test.rb b/activerecord/test/cases/batches_test.rb index fbc3fbb44f..1a66b82b2e 100644 --- a/activerecord/test/cases/batches_test.rb +++ b/activerecord/test/cases/batches_test.rb @@ -152,7 +152,7 @@ class EachTest < ActiveRecord::TestCase end def test_find_in_batches_should_not_use_records_after_yielding_them_in_case_original_array_is_modified - not_a_post = "not a post" + not_a_post = "not a post".dup def not_a_post.id; end not_a_post.stub(:id, -> { raise StandardError.new("not_a_post had #id called on it") }) do assert_nothing_raised do @@ -417,7 +417,7 @@ class EachTest < ActiveRecord::TestCase end def test_in_batches_should_not_use_records_after_yielding_them_in_case_original_array_is_modified - not_a_post = "not a post" + not_a_post = "not a post".dup def not_a_post.id raise StandardError.new("not_a_post had #id called on it") end diff --git a/activerecord/test/cases/binary_test.rb b/activerecord/test/cases/binary_test.rb index 1fc30e24d2..f6ac7990d1 100644 --- a/activerecord/test/cases/binary_test.rb +++ b/activerecord/test/cases/binary_test.rb @@ -10,7 +10,7 @@ unless current_adapter?(:DB2Adapter) FIXTURES = %w(flowers.jpg example.log test.txt) def test_mixed_encoding - str = "\x80" + str = "\x80".dup str.force_encoding("ASCII-8BIT") binary = Binary.new name: "いただきます!", data: str diff --git a/activerecord/test/cases/core_test.rb b/activerecord/test/cases/core_test.rb index 3735572898..936f26ce04 100644 --- a/activerecord/test/cases/core_test.rb +++ b/activerecord/test/cases/core_test.rb @@ -35,7 +35,7 @@ class CoreTest < ActiveRecord::TestCase def test_pretty_print_new topic = Topic.new - actual = "" + actual = "".dup PP.pp(topic, StringIO.new(actual)) expected = <<-PRETTY.strip_heredoc # Date: Sun, 18 Jun 2017 11:14:52 -0400 Subject: Use bulk INSERT to insert fixtures Improves the performance from O(n) to O(1). Previously it would require 50 queries to insert 50 fixtures. Now it takes only one query. Disabled on sqlite which doesn't support multiple inserts. --- activerecord/CHANGELOG.md | 4 ++ .../abstract/database_statements.rb | 56 +++++++++++++++++++--- .../connection_adapters/abstract_mysql_adapter.rb | 17 +++++++ .../connection_adapters/sqlite3_adapter.rb | 6 +++ activerecord/lib/active_record/fixtures.rb | 4 +- .../test/cases/adapters/postgresql/array_test.rb | 6 +++ activerecord/test/cases/fixtures_test.rb | 32 ++++++++++++- activerecord/test/fixtures/naked/yml/parrots.yml | 1 + 8 files changed, 116 insertions(+), 10 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index f75f1a9108..c65deffa8b 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,7 @@ +* Use bulk INSERT to insert fixtures for better performance. + + *Kir Shatrov* + * Prevent making bind param if casted value is nil. *Ryuta Kamizono* diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index 56f0d6d1f4..dc766ce4fc 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -296,6 +296,9 @@ module ActiveRecord # Inserts the given fixture into the table. Overridden in adapters that require # something beyond a simple insert (eg. Oracle). + # Most of adapters should implement `insert_fixtures` that leverages bulk SQL insert. + # We keep this method to provide fallback + # for databases like sqlite that do not support bulk inserts. def insert_fixture(fixture, table_name) fixture = fixture.stringify_keys @@ -312,12 +315,7 @@ module ActiveRecord table = Arel::Table.new(table_name) values = binds.map do |bind| - value = bind.value_for_database - begin - quote(value) - rescue TypeError - value = YAML.dump(value) - end + value = with_yaml_fallback(bind.value_for_database) [table[bind.name], value] end @@ -327,6 +325,40 @@ module ActiveRecord execute manager.to_sql, "Fixture Insert" end + # Inserts a set of fixtures into the table. Overridden in adapters that require + # something beyond a simple insert (eg. Oracle). + def insert_fixtures(fixtures, table_name) + return if fixtures.empty? + + columns = schema_cache.columns_hash(table_name) + + values = fixtures.map do |fixture| + fixture = fixture.stringify_keys + + unknown_columns = fixture.keys - columns.keys + if unknown_columns.any? + raise Fixture::FixtureError, %(table "#{table_name}" has no columns named #{unknown_columns.map(&:inspect).join(', ')}.) + end + + columns.map do |name, column| + if fixture.key?(name) + type = lookup_cast_type_from_column(column) + bind = Relation::QueryAttribute.new(name, fixture[name], type) + with_yaml_fallback(bind.value_for_database) + else + Arel.sql("DEFAULT") + end + end + end + + table = Arel::Table.new(table_name) + manager = Arel::InsertManager.new + manager.into(table) + columns.each_key { |column| manager.columns << table[column] } + manager.values = manager.create_values_list(values) + execute manager.to_sql, "Fixtures Insert" + end + def empty_insert_statement_value "DEFAULT VALUES" end @@ -388,6 +420,18 @@ module ActiveRecord end [relation, binds] end + + # Fixture value is quoted by Arel, however scalar values + # are not quotable. In this case we want to convert + # the column value to YAML. + def with_yaml_fallback(value) + begin + quote(value) + rescue TypeError + value = YAML.dump(value) + end + value + end end end end diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index 648c869915..c42e80ea2c 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -526,8 +526,25 @@ module ActiveRecord index.using == :btree || super end + def insert_fixtures(*) + without_sql_mode("NO_AUTO_VALUE_ON_ZERO") { super } + end + private + def without_sql_mode(mode) + result = execute("SELECT @@SESSION.sql_mode") + current_mode = result.first[0] + return yield unless current_mode.include?(mode) + + sql_mode = "REPLACE(@@sql_mode, '#{mode}', '')" + execute("SET @@SESSION.sql_mode = #{sql_mode}") + yield + ensure + sql_mode = "CONCAT(@@sql_mode, ',#{mode}')" + execute("SET @@SESSION.sql_mode = #{sql_mode}") + end + def initialize_type_map(m) super diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index 7233325d5a..ee2faf43b5 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -349,6 +349,12 @@ module ActiveRecord end end + def insert_fixtures(rows, table_name) + rows.each do |row| + insert_fixture(row, table_name) + end + end + private def table_structure(table_name) diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index a6b66c91e3..e9acb8acae 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -567,9 +567,7 @@ module ActiveRecord end table_rows.each do |fixture_set_name, rows| - rows.each do |row| - conn.insert_fixture(row, fixture_set_name) - end + conn.insert_fixtures(rows, fixture_set_name) end # Cap primary key sequences to max(pk). diff --git a/activerecord/test/cases/adapters/postgresql/array_test.rb b/activerecord/test/cases/adapters/postgresql/array_test.rb index c78c6178ff..121c62dadf 100644 --- a/activerecord/test/cases/adapters/postgresql/array_test.rb +++ b/activerecord/test/cases/adapters/postgresql/array_test.rb @@ -191,6 +191,12 @@ class PostgresqlArrayTest < ActiveRecord::PostgreSQLTestCase assert_equal(PgArray.last.tags, tag_values) end + def test_insert_fixtures + tag_values = ["val1", "val2", "val3_with_'_multiple_quote_'_chars"] + @connection.insert_fixtures([{ "tags" => tag_values }], "pg_arrays") + assert_equal(PgArray.last.tags, tag_values) + end + def test_attribute_for_inspect_for_array_field record = PgArray.new { |a| a.ratings = (1..10).to_a } assert_equal("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]", record.attribute_for_inspect(:ratings)) diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb index a0a6d3c7ef..b499e60922 100644 --- a/activerecord/test/cases/fixtures_test.rb +++ b/activerecord/test/cases/fixtures_test.rb @@ -54,6 +54,31 @@ class FixturesTest < ActiveRecord::TestCase end end + class InsertQuerySubscriber + attr_reader :events + + def initialize + @events = [] + end + + def call(_, _, _, _, values) + @events << values[:sql] if values[:sql] =~ /INSERT/ + end + end + + if current_adapter?(:Mysql2Adapter, :PostgreSQLAdapter) + def test_bulk_insert + begin + subscriber = InsertQuerySubscriber.new + subscription = ActiveSupport::Notifications.subscribe("sql.active_record", subscriber) + create_fixtures("bulbs") + assert_equal 1, subscriber.events.size, "It takes one INSERT query to insert two fixtures" + ensure + ActiveSupport::Notifications.unsubscribe(subscription) + end + end + end + def test_broken_yaml_exception badyaml = Tempfile.new ["foo", ".yml"] badyaml.write "a: : " @@ -248,7 +273,12 @@ class FixturesTest < ActiveRecord::TestCase e = assert_raise(ActiveRecord::Fixture::FixtureError) do ActiveRecord::FixtureSet.create_fixtures(FIXTURES_ROOT + "/naked/yml", "parrots") end - assert_equal(%(table "parrots" has no column named "arrr".), e.message) + + if current_adapter?(:SQLite3Adapter) + assert_equal(%(table "parrots" has no column named "arrr".), e.message) + else + assert_equal(%(table "parrots" has no columns named "arrr", "foobar".), e.message) + end end def test_yaml_file_with_symbol_columns diff --git a/activerecord/test/fixtures/naked/yml/parrots.yml b/activerecord/test/fixtures/naked/yml/parrots.yml index 3e10331105..76f66e01ae 100644 --- a/activerecord/test/fixtures/naked/yml/parrots.yml +++ b/activerecord/test/fixtures/naked/yml/parrots.yml @@ -1,2 +1,3 @@ george: arrr: "Curious George" + foobar: Foobar -- cgit v1.2.3 From f08bc757ebe108df46d76d6fd0029546539f817f Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Sat, 29 Apr 2017 08:21:05 +0000 Subject: Fix destroy with locking_column value null Fix destroying existing object does not work well when optimistic locking enabled and `locking column` is null in the database. Follow 22a822e5813ef7ea9ab6dbbb670a363899a083af, #28914 --- activerecord/CHANGELOG.md | 5 +++++ .../lib/active_record/locking/optimistic.rb | 2 +- activerecord/test/cases/locking_test.rb | 25 ++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index c65deffa8b..f361e44fcd 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,8 @@ +* Fix destroying existing object does not work well when optimistic locking enabled and + `locking column` is null in the database. + + *bogdanvlviv* + * Use bulk INSERT to insert fixtures for better performance. *Kir Shatrov* diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index f8fcb7ccaa..522da6a571 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -128,7 +128,7 @@ module ActiveRecord if locking_enabled? locking_column = self.class.locking_column - relation = relation.where(locking_column => _read_attribute(locking_column)) + relation = relation.where(locking_column => read_attribute_before_type_cast(locking_column)) end relation diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb index 2b139a5da4..703487db35 100644 --- a/activerecord/test/cases/locking_test.rb +++ b/activerecord/test/cases/locking_test.rb @@ -453,6 +453,31 @@ class OptimisticLockingWithSchemaChangeTest < ActiveRecord::TestCase PersonalLegacyThing.reset_column_information end + def test_destroy_existing_object_with_locking_column_value_null_in_the_database + ActiveRecord::Base.connection.execute("INSERT INTO lock_without_defaults(title) VALUES('title1')") + t1 = LockWithoutDefault.last + + assert_equal 0, t1.lock_version + assert_nil t1.lock_version_before_type_cast + + t1.destroy + + assert t1.destroyed? + end + + def test_destroy_stale_object + t1 = LockWithoutDefault.create!(title: "title1") + stale_object = LockWithoutDefault.find(t1.id) + + t1.update!(title: "title2") + + assert_raises(ActiveRecord::StaleObjectError) do + stale_object.destroy! + end + + refute stale_object.destroyed? + end + private def add_counter_column_to(model, col = "test_count") -- cgit v1.2.3 From 4d1264cb5afb93dba198dc559c22a88521fc45c4 Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Fri, 28 Apr 2017 00:23:50 +0300 Subject: Fix ActiveRecord::Persistence#touch with locking `ActiveRecord::Persistence#touch` does not work well when optimistic locking enabled and `locking_column`, without default value, is null in the database. --- activerecord/CHANGELOG.md | 5 +++++ activerecord/lib/active_record/persistence.rb | 2 +- activerecord/test/cases/locking_test.rb | 27 +++++++++++++++++++++++++-- activerecord/test/schema/schema.rb | 2 ++ 4 files changed, 33 insertions(+), 3 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index f361e44fcd..c4ee75c9a2 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,8 @@ +* `ActiveRecord::Persistence#touch` does not work well when optimistic locking enabled and + `locking_column`, without default value, is null in the database. + + *bogdanvlviv* + * Fix destroying existing object does not work well when optimistic locking enabled and `locking column` is null in the database. diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index f652c7c3a1..b2dba5516e 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -526,7 +526,7 @@ module ActiveRecord if locking_enabled? locking_column = self.class.locking_column - scope = scope.where(locking_column => _read_attribute(locking_column)) + scope = scope.where(locking_column => read_attribute_before_type_cast(locking_column)) changes[locking_column] = increment_lock end diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb index 703487db35..2fc52393f2 100644 --- a/activerecord/test/cases/locking_test.rb +++ b/activerecord/test/cases/locking_test.rb @@ -244,10 +244,33 @@ class OptimisticLockingTest < ActiveRecord::TestCase assert_equal 0, t1.lock_version_before_type_cast end + def test_touch_existing_lock_without_default_should_work_with_null_in_the_database + ActiveRecord::Base.connection.execute("INSERT INTO lock_without_defaults(title) VALUES('title1')") + t1 = LockWithoutDefault.last + + assert_equal 0, t1.lock_version + assert_nil t1.lock_version_before_type_cast + + t1.touch + + assert_equal 1, t1.lock_version + end + + def test_touch_stale_object_with_lock_without_default + t1 = LockWithoutDefault.create!(title: "title1") + stale_object = LockWithoutDefault.find(t1.id) + + t1.update!(title: "title2") + + assert_raises(ActiveRecord::StaleObjectError) do + stale_object.touch + end + end + def test_lock_without_default_should_work_with_null_in_the_database ActiveRecord::Base.connection.execute("INSERT INTO lock_without_defaults(title) VALUES('title1')") t1 = LockWithoutDefault.last - t2 = LockWithoutDefault.last + t2 = LockWithoutDefault.find(t1.id) assert_equal 0, t1.lock_version assert_nil t1.lock_version_before_type_cast @@ -304,7 +327,7 @@ class OptimisticLockingTest < ActiveRecord::TestCase ActiveRecord::Base.connection.execute("INSERT INTO lock_without_defaults_cust(title) VALUES('title1')") t1 = LockWithCustomColumnWithoutDefault.last - t2 = LockWithCustomColumnWithoutDefault.last + t2 = LockWithCustomColumnWithoutDefault.find(t1.id) assert_equal 0, t1.custom_lock_version assert_nil t1.custom_lock_version_before_type_cast diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index dc8bdb98ff..6da0ef26f6 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -453,11 +453,13 @@ ActiveRecord::Schema.define do create_table :lock_without_defaults, force: true do |t| t.column :title, :string t.column :lock_version, :integer + t.timestamps null: true end create_table :lock_without_defaults_cust, force: true do |t| t.column :title, :string t.column :custom_lock_version, :integer + t.timestamps null: true end create_table :magazines, force: true do |t| -- cgit v1.2.3 From c7f669af6f1d8e9053a586c97584702971e1906c Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Tue, 20 Jun 2017 17:35:13 -0700 Subject: Clear offset cache on CollectionProxy reset/reload The `@offsets` cache is used by FinderMethods to cache records found by find_nth. This cache is cleared in AR::Relation#reset, but not in CollectionProxy#reset or CollectionProxy#reload. Because of this, since #29098, calling #first/#find_nth/etc after calling #reload or #reset on an association could return a stale record. This is an issue both when the full association target is loaded and when the item is loaded in #find_nth. This commit solves the problem by clearing the `@offsets` cache in CollectionProxy#reset and CollectionProxy#reload. --- .../active_record/associations/collection_proxy.rb | 2 ++ .../associations/has_many_associations_test.rb | 26 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb index 8cdb508c43..88b05bbcfa 100644 --- a/activerecord/lib/active_record/associations/collection_proxy.rb +++ b/activerecord/lib/active_record/associations/collection_proxy.rb @@ -1088,6 +1088,7 @@ module ActiveRecord # # => [#] def reload proxy_association.reload + @offsets = {} reset_scope end @@ -1110,6 +1111,7 @@ module ActiveRecord def reset proxy_association.reset proxy_association.reset_scope + @offsets = {} reset_scope end diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 590d3642bd..ae58dbff21 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -741,6 +741,32 @@ class HasManyAssociationsTest < ActiveRecord::TestCase assert_equal client2, firm.clients.merge!(where: ["#{QUOTED_TYPE} = :type", { type: "Client" }], order: "id").first end + def test_find_first_after_reset + firm = Firm.all.merge!(order: "id").first + + # Calling first twice should return the same object + original_object_id = firm.clients.first.object_id + assert_equal firm.clients.first.object_id, original_object_id, "Expected multiple invocations of #first to return the same object" + + firm.clients.reset + + # It should return a different object, since the association has been reloaded + assert_not_equal original_object_id, firm.clients.first.object_id, "Expected #first after #reload to return a new object" + end + + def test_find_first_after_reload + firm = Firm.all.merge!(order: "id").first + + # Calling first twice should return the same object + original_object_id = firm.clients.first.object_id + assert_equal firm.clients.first.object_id, original_object_id, "Expected multiple invocations of #first to return the same object" + + firm.clients.reload + + # It should return a different object, since the association has been reloaded + assert_not_equal original_object_id, firm.clients.first.object_id, "Expected #first after #reload to return a new object" + end + def test_find_all_with_include_and_conditions assert_nothing_raised do Developer.all.merge!(joins: :audit_logs, where: { "audit_logs.message" => nil, :name => "Smith" }).to_a -- cgit v1.2.3 From 249ddd0c39e6f24145ae1150d4c8eec9f11219b1 Mon Sep 17 00:00:00 2001 From: Maxime Lapointe Date: Wed, 17 Aug 2016 11:16:36 -0400 Subject: Keep INNER JOIN when merging relations Doing `Author.joins(:posts).merge(Post.joins(:comments))` does this `SELECT ... INNER JOIN posts ON... LEFT OUTER JOIN comments ON...` instead of doing `SELECT ... INNER JOIN posts ON... INNER JOIN comments ON...`. This behavior is unexpected and makes little sense as, basically, doing `Post.joins(:comments)` means I want posts that have comments. Turning it to a LEFT JOIN means I want posts and join the comments data, if any. We can see this problem directly in the existing tests. The test_relation_merging_with_merged_joins_as_symbols only does joins from posts to comments to ratings while the ratings fixture isn't loaded, but the count is non-zero. --- activerecord/CHANGELOG.md | 16 +++++++++++++++ .../active_record/associations/join_dependency.rb | 6 +++--- activerecord/test/cases/relation_test.rb | 23 ++++++++++++++++++++-- 3 files changed, 40 insertions(+), 5 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index c4ee75c9a2..d4f4041910 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,19 @@ +* Merging two relations representing nested joins no longer transforms the joins of + the merged relation into LEFT OUTER JOIN. Example to clarify: + + ``` + Author.joins(:posts).merge(Post.joins(:comments)) + # Before the change: + #=> SELECT ... FROM authors INNER JOIN posts ON ... LEFT OUTER JOIN comments ON... + + # After the change: + #=> SELECT ... FROM authors INNER JOIN posts ON ... INNER JOIN comments ON... + ``` + + TODO: Add to the Rails 5.2 upgrade guide + + *Maxime Handfield Lapointe* + * `ActiveRecord::Persistence#touch` does not work well when optimistic locking enabled and `locking_column`, without default value, is null in the database. diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index 643226267c..83e5c23cc4 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -104,17 +104,17 @@ module ActiveRecord join_root.drop(1).map!(&:reflection) end - def join_constraints(outer_joins, join_type) + def join_constraints(joins_to_add, join_type) joins = join_root.children.flat_map { |child| make_join_constraints(join_root, child, join_type) } - joins.concat outer_joins.flat_map { |oj| + joins.concat joins_to_add.flat_map { |oj| if join_root.match? oj.join_root walk join_root, oj.join_root else oj.join_root.children.flat_map { |child| - make_outer_joins oj.join_root, child + make_join_constraints(oj.join_root, child, join_type) } end } diff --git a/activerecord/test/cases/relation_test.rb b/activerecord/test/cases/relation_test.rb index 5fb32270b7..73ce1cda27 100644 --- a/activerecord/test/cases/relation_test.rb +++ b/activerecord/test/cases/relation_test.rb @@ -6,7 +6,7 @@ require "models/rating" module ActiveRecord class RelationTest < ActiveRecord::TestCase - fixtures :posts, :comments, :authors, :author_addresses + fixtures :posts, :comments, :authors, :author_addresses, :ratings FakeKlass = Struct.new(:table_name, :name) do extend ActiveRecord::Delegation::DelegateCache @@ -224,7 +224,26 @@ module ActiveRecord def test_relation_merging_with_merged_joins_as_symbols special_comments_with_ratings = SpecialComment.joins(:ratings) posts_with_special_comments_with_ratings = Post.group("posts.id").joins(:special_comments).merge(special_comments_with_ratings) - assert_equal({ 2 => 1, 4 => 3, 5 => 1 }, authors(:david).posts.merge(posts_with_special_comments_with_ratings).count) + assert_equal({ 4 => 2 }, authors(:david).posts.merge(posts_with_special_comments_with_ratings).count) + end + + def test_relation_merging_with_merged_symbol_joins_keeps_inner_joins + queries = capture_sql { authors_with_commented_posts = Author.joins(:posts).merge(Post.joins(:comments)).to_a } + + nb_inner_join = queries.sum { |sql| sql.scan(/INNER\s+JOIN/i).size } + assert_equal 2, nb_inner_join, "Wrong amount of INNER JOIN in query" + assert queries.none? { |sql| /LEFT\s+(OUTER)?\s+JOIN/i.match?(sql) }, "Shouldn't have any LEFT JOIN in query" + end + + def test_relation_merging_with_merged_symbol_joins_has_correct_size_and_count + # Has one entry per comment + merged_authors_with_commented_posts_relation = Author.joins(:posts).merge(Post.joins(:comments)) + + post_ids_with_author = Post.joins(:author).pluck(:id) + manual_comments_on_post_that_have_author = Comment.where(post_id: post_ids_with_author).pluck(:id) + + assert_equal manual_comments_on_post_that_have_author.size, merged_authors_with_commented_posts_relation.count + assert_equal manual_comments_on_post_that_have_author.size, merged_authors_with_commented_posts_relation.to_a.size end def test_relation_merging_with_joins_as_join_dependency_pick_proper_parent -- cgit v1.2.3 From fa14332ad202dcc941a6dc3863d606e3f3f6e851 Mon Sep 17 00:00:00 2001 From: Kir Shatrov Date: Tue, 20 Jun 2017 23:26:13 -0400 Subject: Avoid begin/rescue in fixture quoting Scalar values like arrays and hashes can't be inserted directly into table. Previously, the way to determine if the value is scalar was to try quoting it. If `quote` raised with an error than the value has to be converted to YAML. This flow is not very obvious. Ideally we could have a `quotable?` method in the connection, but I think that we can avoid begin/rescue block by simply checking if the value is Array or Hash. https://github.com/rails/rails/commit/aa31d21f5f4fc4d679e74a60f9df9706da7de373 --- .../connection_adapters/abstract/database_statements.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index dc766ce4fc..af5314c1d6 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -425,12 +425,11 @@ module ActiveRecord # are not quotable. In this case we want to convert # the column value to YAML. def with_yaml_fallback(value) - begin - quote(value) - rescue TypeError - value = YAML.dump(value) + if value.is_a?(Hash) || value.is_a?(Array) + YAML.dump(value) + else + value end - value end end end -- cgit v1.2.3 From bed0fa8a88d8d51acb7d6084db76ab1cce7ecccc Mon Sep 17 00:00:00 2001 From: Edouard CHIN Date: Wed, 21 Jun 2017 13:54:14 -0400 Subject: pass `structure_dump_flags` / `structure_load_flags` options before any other: - On Mysql, some command line options that affect option-file handling such as `--no-defaults` have to be passed before any other options - Modified rails to pass them right after the `mysql` command - Ref https://dev.mysql.com/doc/refman/5.7/en/option-file-options.html and https://bugs.mysql.com/bug.php?id=83386 - Ref #27437 --- activerecord/lib/active_record/tasks/mysql_database_tasks.rb | 4 ++-- activerecord/test/cases/tasks/mysql_rake_test.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb index 541165b3d1..5b1eba6345 100644 --- a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb @@ -59,7 +59,6 @@ module ActiveRecord args.concat(["--no-data"]) args.concat(["--routines"]) args.concat(["--skip-comments"]) - args.concat(Array(extra_flags)) if extra_flags ignore_tables = ActiveRecord::SchemaDumper.ignore_tables if ignore_tables.any? @@ -67,6 +66,7 @@ module ActiveRecord end args.concat(["#{configuration['database']}"]) + args.insert(0, Array(extra_flags)).flatten! if extra_flags run_cmd("mysqldump", args, "dumping") end @@ -75,7 +75,7 @@ module ActiveRecord args = prepare_command_options args.concat(["--execute", %{SET FOREIGN_KEY_CHECKS = 0; SOURCE #{filename}; SET FOREIGN_KEY_CHECKS = 1}]) args.concat(["--database", "#{configuration['database']}"]) - args.concat(Array(extra_flags)) if extra_flags + args.insert(0, Array(extra_flags)).flatten! if extra_flags run_cmd("mysql", args, "loading") end diff --git a/activerecord/test/cases/tasks/mysql_rake_test.rb b/activerecord/test/cases/tasks/mysql_rake_test.rb index c22d974536..9c6fb14376 100644 --- a/activerecord/test/cases/tasks/mysql_rake_test.rb +++ b/activerecord/test/cases/tasks/mysql_rake_test.rb @@ -296,7 +296,7 @@ if current_adapter?(:Mysql2Adapter) def test_structure_dump_with_extra_flags filename = "awesome-file.sql" - expected_command = ["mysqldump", "--result-file", filename, "--no-data", "--routines", "--skip-comments", "--noop", "test-db"] + expected_command = ["mysqldump", "--noop", "--result-file", filename, "--no-data", "--routines", "--skip-comments", "test-db"] assert_called_with(Kernel, :system, expected_command, returns: true) do with_structure_dump_flags(["--noop"]) do @@ -364,7 +364,7 @@ if current_adapter?(:Mysql2Adapter) def test_structure_load filename = "awesome-file.sql" - expected_command = ["mysql", "--execute", %{SET FOREIGN_KEY_CHECKS = 0; SOURCE #{filename}; SET FOREIGN_KEY_CHECKS = 1}, "--database", "test-db", "--noop"] + expected_command = ["mysql", "--noop", "--execute", %{SET FOREIGN_KEY_CHECKS = 0; SOURCE #{filename}; SET FOREIGN_KEY_CHECKS = 1}, "--database", "test-db"] assert_called_with(Kernel, :system, expected_command, returns: true) do with_structure_load_flags(["--noop"]) do -- cgit v1.2.3 From 8f1486f2697095749777c7896ab5bf9211a4b8d3 Mon Sep 17 00:00:00 2001 From: Edouard CHIN Date: Wed, 21 Jun 2017 14:08:12 -0400 Subject: PR Review --- activerecord/lib/active_record/tasks/mysql_database_tasks.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb index 5b1eba6345..c25d87dd3e 100644 --- a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb @@ -66,7 +66,7 @@ module ActiveRecord end args.concat(["#{configuration['database']}"]) - args.insert(0, Array(extra_flags)).flatten! if extra_flags + args.unshift(*extra_flags) if extra_flags run_cmd("mysqldump", args, "dumping") end @@ -75,7 +75,7 @@ module ActiveRecord args = prepare_command_options args.concat(["--execute", %{SET FOREIGN_KEY_CHECKS = 0; SOURCE #{filename}; SET FOREIGN_KEY_CHECKS = 1}]) args.concat(["--database", "#{configuration['database']}"]) - args.insert(0, Array(extra_flags)).flatten! if extra_flags + args.unshift(*extra_flags) if extra_flags run_cmd("mysql", args, "loading") end -- cgit v1.2.3 From adcd3079970ea7ef715ddfb8d2a386971d73eb52 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Tue, 20 Jun 2017 17:35:13 -0700 Subject: Move clearing of @offsets cache to reset_scope --- .../active_record/associations/collection_proxy.rb | 3 +- .../associations/has_many_associations_test.rb | 33 ++++++++++++++-------- 2 files changed, 22 insertions(+), 14 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb index 88b05bbcfa..d77fcaf668 100644 --- a/activerecord/lib/active_record/associations/collection_proxy.rb +++ b/activerecord/lib/active_record/associations/collection_proxy.rb @@ -1088,7 +1088,6 @@ module ActiveRecord # # => [#] def reload proxy_association.reload - @offsets = {} reset_scope end @@ -1111,11 +1110,11 @@ module ActiveRecord def reset proxy_association.reset proxy_association.reset_scope - @offsets = {} reset_scope end def reset_scope # :nodoc: + @offsets = {} @scope = nil self end diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index ae58dbff21..169e1a5449 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -741,30 +741,39 @@ class HasManyAssociationsTest < ActiveRecord::TestCase assert_equal client2, firm.clients.merge!(where: ["#{QUOTED_TYPE} = :type", { type: "Client" }], order: "id").first end - def test_find_first_after_reset + def test_find_first_after_reset_scope firm = Firm.all.merge!(order: "id").first + collection = firm.clients + + original_object_id = collection.first.object_id + assert_equal original_object_id, collection.first.object_id, "Expected second call to #first to cache the same object" + + # It should return a different object, since the association has been reloaded + assert_not_equal original_object_id, firm.clients.first.object_id, "Expected #first to return a new object" + end - # Calling first twice should return the same object - original_object_id = firm.clients.first.object_id - assert_equal firm.clients.first.object_id, original_object_id, "Expected multiple invocations of #first to return the same object" + def test_find_first_after_reset + firm = Firm.all.merge!(order: "id").first + collection = firm.clients - firm.clients.reset + original_object_id = collection.first.object_id + assert_equal original_object_id, collection.first.object_id, "Expected second call to #first to cache the same object" + collection.reset # It should return a different object, since the association has been reloaded - assert_not_equal original_object_id, firm.clients.first.object_id, "Expected #first after #reload to return a new object" + assert_not_equal original_object_id, collection.first.object_id, "Expected #first after #reload to return a new object" end def test_find_first_after_reload firm = Firm.all.merge!(order: "id").first + collection = firm.clients - # Calling first twice should return the same object - original_object_id = firm.clients.first.object_id - assert_equal firm.clients.first.object_id, original_object_id, "Expected multiple invocations of #first to return the same object" - - firm.clients.reload + original_object_id = collection.first.object_id + assert_equal original_object_id, collection.first.object_id, "Expected second call to #first to cache the same object" + collection.reset # It should return a different object, since the association has been reloaded - assert_not_equal original_object_id, firm.clients.first.object_id, "Expected #first after #reload to return a new object" + assert_not_equal original_object_id, collection.first.object_id, "Expected #first after #reload to return a new object" end def test_find_all_with_include_and_conditions -- cgit v1.2.3 From 5fac725a4a1d9afb4402e442ed6a7099a594be73 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Thu, 22 Jun 2017 09:13:02 +0900 Subject: Remove unused variable This fixes the following warnings: ``` activerecord/test/cases/relation_test.rb:231: warning: assigned but unused variable - authors_with_commented_posts ``` --- activerecord/test/cases/relation_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/relation_test.rb b/activerecord/test/cases/relation_test.rb index 73ce1cda27..a403824f1a 100644 --- a/activerecord/test/cases/relation_test.rb +++ b/activerecord/test/cases/relation_test.rb @@ -228,7 +228,7 @@ module ActiveRecord end def test_relation_merging_with_merged_symbol_joins_keeps_inner_joins - queries = capture_sql { authors_with_commented_posts = Author.joins(:posts).merge(Post.joins(:comments)).to_a } + queries = capture_sql { Author.joins(:posts).merge(Post.joins(:comments)).to_a } nb_inner_join = queries.sum { |sql| sql.scan(/INNER\s+JOIN/i).size } assert_equal 2, nb_inner_join, "Wrong amount of INNER JOIN in query" -- cgit v1.2.3 From dbf8ab7f1db400473dd2ac8cd67fc9462f51bc15 Mon Sep 17 00:00:00 2001 From: Nick Rivadeneira Date: Thu, 22 Jun 2017 10:35:40 -0400 Subject: Ensure `false` is preserved in attr serialization --- activerecord/lib/active_record/attribute.rb | 2 +- activerecord/test/cases/yaml_serialization_test.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/attribute.rb b/activerecord/lib/active_record/attribute.rb index 38281158d8..78662433eb 100644 --- a/activerecord/lib/active_record/attribute.rb +++ b/activerecord/lib/active_record/attribute.rb @@ -122,7 +122,7 @@ module ActiveRecord def encode_with(coder) coder["name"] = name - coder["value_before_type_cast"] = value_before_type_cast if value_before_type_cast + coder["value_before_type_cast"] = value_before_type_cast unless value_before_type_cast.nil? coder["type"] = type if type coder["original_attribute"] = original_attribute if original_attribute coder["value"] = value if defined?(@value) diff --git a/activerecord/test/cases/yaml_serialization_test.rb b/activerecord/test/cases/yaml_serialization_test.rb index bfc13d683d..dd8d2c1178 100644 --- a/activerecord/test/cases/yaml_serialization_test.rb +++ b/activerecord/test/cases/yaml_serialization_test.rb @@ -119,6 +119,14 @@ class YamlSerializationTest < ActiveRecord::TestCase assert_equal author.changes, dumped.changes end + def test_yaml_encoding_keeps_false_values + topic = Topic.first + topic.approved = false + dumped = YAML.load(YAML.dump(topic)) + + assert_equal false, dumped.approved + end + private def yaml_fixture(file_name) -- cgit v1.2.3 From cc93d0d47bb7b0773f4dbe0654bcd551e2762de8 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sat, 3 Jun 2017 15:57:41 +0900 Subject: Extract `build_scope` and `predicate_builder` in `Reflection` --- .../lib/active_record/associations/association_scope.rb | 7 +++---- .../associations/join_dependency/join_association.rb | 2 +- activerecord/lib/active_record/reflection.rb | 17 ++++++++++------- 3 files changed, 14 insertions(+), 12 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb index 1593b94f0c..525cfdb028 100644 --- a/activerecord/lib/active_record/associations/association_scope.rb +++ b/activerecord/lib/active_record/associations/association_scope.rb @@ -138,7 +138,7 @@ module ActiveRecord # Exclude the scope of the association itself, because that # was already merged in the #scope method. reflection.constraints.each do |scope_chain_item| - item = eval_scope(reflection.klass, table, scope_chain_item, owner) + item = eval_scope(reflection, table, scope_chain_item, owner) if scope_chain_item == refl.scope scope.merge! item.except(:where, :includes) @@ -159,9 +159,8 @@ module ActiveRecord scope end - def eval_scope(klass, table, scope, owner) - predicate_builder = PredicateBuilder.new(TableMetadata.new(klass, table)) - ActiveRecord::Relation.create(klass, table, predicate_builder).instance_exec(owner, &scope) + def eval_scope(reflection, table, scope, owner) + reflection.build_scope(table).instance_exec(owner, &scope) end end end diff --git a/activerecord/lib/active_record/associations/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/join_dependency/join_association.rb index 97cfec0302..7fa62bfa5f 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb @@ -40,7 +40,7 @@ module ActiveRecord constraint = build_constraint(klass, table, key, foreign_table, foreign_key) - predicate_builder = PredicateBuilder.new(TableMetadata.new(klass, table)) + predicate_builder = reflection.predicate_builder(table) scope_chain_items = reflection.join_scopes(table, predicate_builder) klass_scope = reflection.klass_join_scope(table, predicate_builder) diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index e8ee8279fd..c4b58386fa 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -187,8 +187,7 @@ module ActiveRecord def join_scopes(table, predicate_builder) # :nodoc: if scope - [ActiveRecord::Relation.create(klass, table, predicate_builder) - .instance_exec(&scope)] + [build_scope(table, predicate_builder).instance_exec(&scope)] else [] end @@ -200,11 +199,7 @@ module ActiveRecord scope.joins_values = scope.left_outer_joins_values = [].freeze } else - relation = ActiveRecord::Relation.create( - klass, - table, - predicate_builder, - ) + relation = build_scope(table, predicate_builder) klass.send(:build_default_scope, relation) end end @@ -287,6 +282,14 @@ module ActiveRecord JoinKeys.new(join_pk(association_klass), join_fk) end + def build_scope(table, predicate_builder = predicate_builder(table)) + Relation.create(klass, table, predicate_builder) + end + + def predicate_builder(table) + PredicateBuilder.new(TableMetadata.new(klass, table)) + end + protected def actual_source_reflection # FIXME: this is a horrible name self -- cgit v1.2.3 From f250da5397b967fcba58356547bc26127c1be93e Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sat, 24 Jun 2017 19:08:39 +0900 Subject: Extract `ordered_relation` in `FinderMethods` --- .../lib/active_record/relation/finder_methods.rb | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 1d661fa8ed..5ec2dfcfc9 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -147,8 +147,7 @@ module ActiveRecord def last(limit = nil) return find_last(limit) if loaded? || limit_value - result = limit(limit) - result.order!(arel_attribute(primary_key)) if order_values.empty? && primary_key + result = ordered_relation.limit(limit) result = result.reverse_order! limit ? result.reverse : result.first @@ -535,11 +534,7 @@ module ActiveRecord if loaded? records[index, limit] || [] else - relation = if order_values.empty? && primary_key - order(arel_attribute(primary_key).asc) - else - self - end + relation = ordered_relation if limit_value.nil? || index < limit_value relation = relation.offset(offset_index + index) unless index.zero? @@ -554,11 +549,7 @@ module ActiveRecord if loaded? records[-index] else - relation = if order_values.empty? && primary_key - order(arel_attribute(primary_key).asc) - else - self - end + relation = ordered_relation relation.to_a[-index] # TODO: can be made more performant on large result sets by @@ -572,5 +563,13 @@ module ActiveRecord def find_last(limit) limit ? records.last(limit) : records.last end + + def ordered_relation + if order_values.empty? && primary_key + order(arel_attribute(primary_key).asc) + else + self + end + end end end -- cgit v1.2.3 From 3d9e8d7c110f7053d73f61f2297bd46722294121 Mon Sep 17 00:00:00 2001 From: Ray Zane Date: Mon, 13 Feb 2017 23:38:38 -0500 Subject: The AliasTracker#aliased_table_for needs the type caster for the joined association, not the join root --- .../lib/active_record/associations/alias_tracker.rb | 19 +++++++++---------- .../active_record/associations/association_scope.rb | 8 ++++++-- .../lib/active_record/associations/join_dependency.rb | 5 +++-- 3 files changed, 18 insertions(+), 14 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/alias_tracker.rb b/activerecord/lib/active_record/associations/alias_tracker.rb index 4a5c821607..104de4f69d 100644 --- a/activerecord/lib/active_record/associations/alias_tracker.rb +++ b/activerecord/lib/active_record/associations/alias_tracker.rb @@ -4,21 +4,21 @@ module ActiveRecord module Associations # Keeps track of table aliases for ActiveRecord::Associations::JoinDependency class AliasTracker # :nodoc: - def self.create(connection, initial_table, type_caster) + def self.create(connection, initial_table) aliases = Hash.new(0) aliases[initial_table] = 1 - new connection, aliases, type_caster + new(connection, aliases) end - def self.create_with_joins(connection, initial_table, joins, type_caster) + def self.create_with_joins(connection, initial_table, joins) if joins.empty? - create(connection, initial_table, type_caster) + create(connection, initial_table) else aliases = Hash.new { |h, k| h[k] = initial_count_for(connection, k, joins) } aliases[initial_table] = 1 - new connection, aliases, type_caster + new(connection, aliases) end end @@ -51,17 +51,16 @@ module ActiveRecord end # table_joins is an array of arel joins which might conflict with the aliases we assign here - def initialize(connection, aliases, type_caster) + def initialize(connection, aliases) @aliases = aliases @connection = connection - @type_caster = type_caster end - def aliased_table_for(table_name, aliased_name) + def aliased_table_for(table_name, aliased_name, type_caster) if aliases[table_name].zero? # If it's zero, we can have our table_name aliases[table_name] = 1 - Arel::Table.new(table_name, type_caster: @type_caster) + Arel::Table.new(table_name, type_caster: type_caster) else # Otherwise, we need to use an alias aliased_name = @connection.table_alias_for(aliased_name) @@ -74,7 +73,7 @@ module ActiveRecord else aliased_name end - Arel::Table.new(table_name, type_caster: @type_caster).alias(table_alias) + Arel::Table.new(table_name, type_caster: type_caster).alias(table_alias) end end diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb index 1593b94f0c..4ce4252224 100644 --- a/activerecord/lib/active_record/associations/association_scope.rb +++ b/activerecord/lib/active_record/associations/association_scope.rb @@ -21,7 +21,7 @@ module ActiveRecord reflection = association.reflection scope = klass.unscoped owner = association.owner - alias_tracker = AliasTracker.create connection, association.klass.table_name, klass.type_caster + alias_tracker = AliasTracker.create connection, association.klass.table_name chain_head, chain_tail = get_chain(reflection, association, alias_tracker) scope.extending! reflection.extensions @@ -112,7 +112,11 @@ module ActiveRecord runtime_reflection = Reflection::RuntimeReflection.new(reflection, association) previous_reflection = runtime_reflection reflection.chain.drop(1).each do |refl| - alias_name = tracker.aliased_table_for(refl.table_name, refl.alias_candidate(name)) + alias_name = tracker.aliased_table_for( + refl.table_name, + refl.alias_candidate(name), + refl.klass.type_caster + ) proxy = ReflectionProxy.new(refl, alias_name) previous_reflection.next = proxy previous_reflection = proxy diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index 83e5c23cc4..bc66194aef 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -93,7 +93,7 @@ module ActiveRecord # joins # => [] # def initialize(base, associations, joins, eager_loading: true) - @alias_tracker = AliasTracker.create_with_joins(base.connection, base.table_name, joins, base.type_caster) + @alias_tracker = AliasTracker.create_with_joins(base.connection, base.table_name, joins) @eager_loading = eager_loading tree = self.class.make_tree associations @join_root = JoinBase.new base, build(tree, base) @@ -185,7 +185,8 @@ module ActiveRecord node.reflection.chain.map { |reflection| alias_tracker.aliased_table_for( reflection.table_name, - table_alias_for(reflection, parent, reflection != node.reflection) + table_alias_for(reflection, parent, reflection != node.reflection), + reflection.klass.type_caster ) } end -- cgit v1.2.3 From 135437cbb660ec0db5dc2cca1c78c6ad985ec807 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 25 Jun 2017 21:55:38 +0900 Subject: Ensure that using correct alias tracker Covering #27994 in tests. Closes #27994. --- activerecord/test/models/membership.rb | 1 + activerecord/test/schema/schema.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/test/models/membership.rb b/activerecord/test/models/membership.rb index 2c3ad230a7..0f8be0ad85 100644 --- a/activerecord/test/models/membership.rb +++ b/activerecord/test/models/membership.rb @@ -1,4 +1,5 @@ class Membership < ActiveRecord::Base + enum type: %i(Membership CurrentMembership SuperMembership SelectedMembership TenantMembership) belongs_to :member belongs_to :club end diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index 6da0ef26f6..d7ceb6d4ef 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -491,7 +491,7 @@ ActiveRecord::Schema.define do t.datetime :joined_on t.integer :club_id, :member_id t.boolean :favourite, default: false - t.string :type + t.integer :type end create_table :member_types, force: true do |t| -- cgit v1.2.3 From 5dafa72935fbb0656f814f26f94e46f545890214 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Mon, 26 Jun 2017 02:23:35 +0900 Subject: Fix extracting `references` via `order_values` to respect quoting --- activerecord/lib/active_record/relation/query_methods.rb | 2 +- activerecord/test/cases/relations_test.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 6ccdd7adcb..d44f6fd572 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -1122,7 +1122,7 @@ module ActiveRecord validate_order_args(order_args) references = order_args.grep(String) - references.map! { |arg| arg =~ /^([a-zA-Z]\w*)\.(\w+)/ && $1 }.compact! + references.map! { |arg| arg =~ /^\W?(\w+)\W?\./ && $1 }.compact! references!(references) if references.any? # if a symbol is given we prepend the quoted table name diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 86f3b0b962..dc81f13fe9 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -1717,6 +1717,9 @@ class RelationTest < ActiveRecord::TestCase scope = Post.order("comments.body") assert_equal ["comments"], scope.references_values + scope = Post.order("#{Comment.quoted_table_name}.#{Comment.quoted_primary_key}") + assert_equal ["comments"], scope.references_values + scope = Post.order("comments.body", "yaks.body") assert_equal ["comments", "yaks"], scope.references_values @@ -1735,6 +1738,9 @@ class RelationTest < ActiveRecord::TestCase scope = Post.reorder("comments.body") assert_equal %w(comments), scope.references_values + scope = Post.reorder("#{Comment.quoted_table_name}.#{Comment.quoted_primary_key}") + assert_equal ["comments"], scope.references_values + scope = Post.reorder("comments.body", "yaks.body") assert_equal %w(comments yaks), scope.references_values -- cgit v1.2.3 From c9cf8b8dd4b968e21768f495d6ed0861a6efe08c Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Mon, 26 Jun 2017 03:19:24 +0900 Subject: Move constructing join scope to `Reflection` --- .../associations/join_dependency/join_association.rb | 10 +--------- activerecord/lib/active_record/reflection.rb | 15 +++++++++++---- 2 files changed, 12 insertions(+), 13 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/join_dependency/join_association.rb index 7fa62bfa5f..95f16c622e 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb @@ -40,15 +40,7 @@ module ActiveRecord constraint = build_constraint(klass, table, key, foreign_table, foreign_key) - predicate_builder = reflection.predicate_builder(table) - scope_chain_items = reflection.join_scopes(table, predicate_builder) - klass_scope = reflection.klass_join_scope(table, predicate_builder) - - scope_chain_items.concat [klass_scope].compact - - rel = scope_chain_items.inject(scope_chain_items.shift) do |left, right| - left.merge right - end + rel = reflection.join_scope(table) if rel && !rel.arel.constraints.empty? binds += rel.bound_attributes diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index c4b58386fa..c6aa2ed720 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -185,6 +185,14 @@ module ActiveRecord end deprecate :scope_chain + def join_scope(table) + predicate_builder = predicate_builder(table) + scope_chain_items = join_scopes(table, predicate_builder) + klass_scope = klass_join_scope(table, predicate_builder) + + scope_chain_items.inject(klass_scope || scope_chain_items.shift, &:merge!) + end + def join_scopes(table, predicate_builder) # :nodoc: if scope [build_scope(table, predicate_builder).instance_exec(&scope)] @@ -286,16 +294,15 @@ module ActiveRecord Relation.create(klass, table, predicate_builder) end - def predicate_builder(table) - PredicateBuilder.new(TableMetadata.new(klass, table)) - end - protected def actual_source_reflection # FIXME: this is a horrible name self end private + def predicate_builder(table) + PredicateBuilder.new(TableMetadata.new(klass, table)) + end def join_pk(_) foreign_key -- cgit v1.2.3 From 0496b7b3b2f38cba8b6fc7fbbff70a0bb5e4bc43 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Tue, 27 Jun 2017 18:18:04 +0900 Subject: Skip instantiating `NullPreloader` if `assoc.klass` is nil Simply we can skip instantiating `NullPreloader` if `assoc.klass` is nil. --- activerecord/lib/active_record/associations/preloader.rb | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/preloader.rb b/activerecord/lib/active_record/associations/preloader.rb index 9f77f38b35..208d1b2670 100644 --- a/activerecord/lib/active_record/associations/preloader.rb +++ b/activerecord/lib/active_record/associations/preloader.rb @@ -147,7 +147,7 @@ module ActiveRecord def preloaders_for_one(association, records, scope) grouped_records(association, records).flat_map do |reflection, klasses| klasses.map do |rhs_klass, rs| - loader = preloader_for(reflection, rs, rhs_klass).new(rhs_klass, rs, reflection, scope) + loader = preloader_for(reflection, rs).new(rhs_klass, rs, reflection, scope) loader.run self loader end @@ -159,6 +159,7 @@ module ActiveRecord records.each do |record| next unless record assoc = record.association(association) + next unless assoc.klass klasses = h[assoc.reflection] ||= {} (klasses[assoc.klass] ||= []) << record end @@ -180,20 +181,11 @@ module ActiveRecord end end - class NullPreloader # :nodoc: - def self.new(klass, owners, reflection, preload_scope); self; end - def self.run(preloader); end - def self.preloaded_records; []; end - def self.owners; []; end - end - # Returns a class containing the logic needed to load preload the data # and attach it to a relation. For example +Preloader::Association+ or # +Preloader::HasManyThrough+. The class returned implements a `run` method # that accepts a preloader. - def preloader_for(reflection, owners, rhs_klass) - return NullPreloader unless rhs_klass - + def preloader_for(reflection, owners) if owners.first.association(reflection.name).loaded? return AlreadyLoaded end -- cgit v1.2.3 From 23bcc6578e28355cc7258c744bcb26c0c80524ef Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Tue, 27 Jun 2017 18:47:42 +0900 Subject: Move constructing polymorphic type to `join_scope` in `Reflection` --- .../associations/join_dependency/join_association.rb | 12 ++---------- activerecord/lib/active_record/reflection.rb | 11 +++++++---- activerecord/lib/active_record/scoping/named.rb | 3 +-- 3 files changed, 10 insertions(+), 16 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/join_dependency/join_association.rb index 95f16c622e..70520b8e85 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb @@ -40,21 +40,13 @@ module ActiveRecord constraint = build_constraint(klass, table, key, foreign_table, foreign_key) - rel = reflection.join_scope(table) + rel = reflection.join_scope(table, foreign_klass) - if rel && !rel.arel.constraints.empty? + if rel.arel.constraints.any? binds += rel.bound_attributes constraint = constraint.and rel.arel.constraints end - if reflection.type - value = foreign_klass.base_class.name - column = klass.columns_hash[reflection.type.to_s] - - binds << Relation::QueryAttribute.new(column.name, value, klass.type_for_attribute(column.name)) - constraint = constraint.and klass.arel_attribute(reflection.type, table).eq(Arel::Nodes::BindParam.new) - end - joins << table.create_join(table, table.create_on(constraint), join_type) # The current table in this iteration becomes the foreign table in the next diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index c6aa2ed720..4e3359bb4e 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -185,12 +185,16 @@ module ActiveRecord end deprecate :scope_chain - def join_scope(table) + def join_scope(table, foreign_klass) predicate_builder = predicate_builder(table) scope_chain_items = join_scopes(table, predicate_builder) klass_scope = klass_join_scope(table, predicate_builder) - scope_chain_items.inject(klass_scope || scope_chain_items.shift, &:merge!) + if type + klass_scope.where!(type => foreign_klass.base_class.name) + end + + scope_chain_items.inject(klass_scope, &:merge!) end def join_scopes(table, predicate_builder) # :nodoc: @@ -207,8 +211,7 @@ module ActiveRecord scope.joins_values = scope.left_outer_joins_values = [].freeze } else - relation = build_scope(table, predicate_builder) - klass.send(:build_default_scope, relation) + klass.default_scoped(build_scope(table, predicate_builder)) end end diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb index a61fdd6454..388f471bf5 100644 --- a/activerecord/lib/active_record/scoping/named.rb +++ b/activerecord/lib/active_record/scoping/named.rb @@ -29,8 +29,7 @@ module ActiveRecord end end - def default_scoped # :nodoc: - scope = relation + def default_scoped(scope = relation) # :nodoc: build_default_scope(scope) || scope end -- cgit v1.2.3 From 442c15f1419ae60e4345866e5af59376a679e9d1 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Tue, 27 Jun 2017 20:13:17 +0900 Subject: Move building constraint to `join_scope` in `Reflection` --- .../join_dependency/join_association.rb | 42 ++-------------------- activerecord/lib/active_record/reflection.rb | 13 +++++-- 2 files changed, 14 insertions(+), 41 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/join_dependency/join_association.rb index 70520b8e85..005410d598 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb @@ -34,18 +34,10 @@ module ActiveRecord table = tables.shift klass = reflection.klass - join_keys = reflection.join_keys - key = join_keys.key - foreign_key = join_keys.foreign_key + join_scope = reflection.join_scope(table, foreign_table, foreign_klass) - constraint = build_constraint(klass, table, key, foreign_table, foreign_key) - - rel = reflection.join_scope(table, foreign_klass) - - if rel.arel.constraints.any? - binds += rel.bound_attributes - constraint = constraint.and rel.arel.constraints - end + binds.concat join_scope.bound_attributes + constraint = join_scope.arel.constraints joins << table.create_join(table, table.create_on(constraint), join_type) @@ -56,34 +48,6 @@ module ActiveRecord JoinInformation.new joins, binds end - # Builds equality condition. - # - # Example: - # - # class Physician < ActiveRecord::Base - # has_many :appointments - # end - # - # If I execute `Physician.joins(:appointments).to_a` then - # klass # => Physician - # table # => # - # key # => physician_id - # foreign_table # => # - # foreign_key # => id - # - def build_constraint(klass, table, key, foreign_table, foreign_key) - constraint = table[key].eq(foreign_table[foreign_key]) - - if klass.finder_needs_type_condition? - constraint = table.create_and([ - constraint, - klass.send(:type_condition, table) - ]) - end - - constraint - end - def table tables.first end diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 4e3359bb4e..3d3ec862a3 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -171,7 +171,7 @@ module ActiveRecord JoinKeys = Struct.new(:key, :foreign_key) # :nodoc: def join_keys - get_join_keys klass + @join_keys ||= get_join_keys(klass) end # Returns a list of scopes that should be applied for this Reflection @@ -185,11 +185,20 @@ module ActiveRecord end deprecate :scope_chain - def join_scope(table, foreign_klass) + def join_scope(table, foreign_table, foreign_klass) predicate_builder = predicate_builder(table) scope_chain_items = join_scopes(table, predicate_builder) klass_scope = klass_join_scope(table, predicate_builder) + key = join_keys.key + foreign_key = join_keys.foreign_key + + klass_scope.where!(table[key].eq(foreign_table[foreign_key])) + + if klass.finder_needs_type_condition? + klass_scope.where!(klass.send(:type_condition, table)) + end + if type klass_scope.where!(type => foreign_klass.base_class.name) end -- cgit v1.2.3 From e2d8f1844de4e9c8f9eba79ce98d62fa6c901b7c Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 28 Jun 2017 17:23:55 +0900 Subject: Show query cache keys in `test_exceptional_middleware_clears_and_disables_cache_on_error` `test_exceptional_middleware_clears_and_disables_cache_on_error` in postgresql adapter sometime fails recently. Show the query cache keys to investigte the cause. https://travis-ci.org/rails/rails/jobs/246467252#L490-L493 --- activerecord/test/cases/query_cache_test.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb index 9b741545d7..c2d40f2940 100644 --- a/activerecord/test/cases/query_cache_test.rb +++ b/activerecord/test/cases/query_cache_test.rb @@ -42,7 +42,8 @@ class QueryCacheTest < ActiveRecord::TestCase mw = middleware { |env| Task.find 1 Task.find 1 - assert_equal 1, ActiveRecord::Base.connection.query_cache.length + query_cache = ActiveRecord::Base.connection.query_cache + assert_equal 1, query_cache.length, query_cache.keys raise "lol borked" } assert_raises(RuntimeError) { mw.call({}) } -- cgit v1.2.3 From 3e6ce1cd698878d3324a5eda32bd600bfcb909f8 Mon Sep 17 00:00:00 2001 From: Grey Baker Date: Tue, 27 Jun 2017 11:06:28 +0100 Subject: Add source code and changelog links to gemspecs --- activerecord/activerecord.gemspec | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activerecord') diff --git a/activerecord/activerecord.gemspec b/activerecord/activerecord.gemspec index 450ec0bba9..a626a1f21b 100644 --- a/activerecord/activerecord.gemspec +++ b/activerecord/activerecord.gemspec @@ -21,6 +21,11 @@ Gem::Specification.new do |s| s.extra_rdoc_files = %w(README.rdoc) s.rdoc_options.concat ["--main", "README.rdoc"] + s.metadata = { + "source_code_uri" => "https://github.com/rails/rails/tree/v#{version}/activerecord", + "changelog_uri" => "https://github.com/rails/rails/blob/v#{version}/activerecord/CHANGELOG.md" + } + s.add_dependency "activesupport", version s.add_dependency "activemodel", version -- cgit v1.2.3 From c41247a3d273f415cf2c7aae7aff490234815ad9 Mon Sep 17 00:00:00 2001 From: Tobias Kraze Date: Tue, 27 Jun 2017 17:41:39 +0200 Subject: ActiveRecord: do not create "has many through" records that have been removed If a record was built on a HasManyThroughAssociation, then removed, and then the record was saved, the removed record would be created anyways. --- activerecord/CHANGELOG.md | 7 +++++++ .../associations/has_many_through_association.rb | 5 +++++ .../cases/associations/has_many_through_associations_test.rb | 11 +++++++++++ 3 files changed, 23 insertions(+) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index d4f4041910..f780029a18 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,10 @@ +* Previously, when building records using a `has_many :through` association, + if the child records were deleted before the parent was saved, they would + still be persisted. Now, if child records are deleted before the parent is saved + on a `has_many :through` association, the child records will not be persisted. + + *Tobias Kraze* + * Merging two relations representing nested joins no longer transforms the joins of the merged relation into LEFT OUTER JOIN. Example to clarify: diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb index 53ffb3b68d..2fd20b4368 100644 --- a/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -109,6 +109,11 @@ module ActiveRecord record end + def remove_records(existing_records, records, method) + super + delete_through_records(records) + end + def target_reflection_has_associated_record? !(through_reflection.belongs_to? && owner[through_reflection.foreign_key].blank?) end diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb index 9156f6d57a..1c2138a3d0 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -319,6 +319,17 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase assert_includes post.single_people, person end + def test_build_then_remove_then_save + post = posts(:thinking) + post.people.build(first_name: "Bob") + ted = post.people.build(first_name: "Ted") + post.people.delete(ted) + post.save! + post.reload + + assert_equal ["Bob"], post.people.collect(&:first_name) + end + def test_both_parent_ids_set_when_saving_new post = Post.new(title: "Hello", body: "world") person = Person.new(first_name: "Sean") -- cgit v1.2.3 From e614be2d803f9dceae3c4192a7b9f75834dab3ea Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 28 Jun 2017 21:17:06 +0900 Subject: Use `reload` in `test_find_first_after_reload` And use `assert_same` instead of `assert_equal` and tiny fix assert message s/#reload/#reset/. Follow up of #29511. --- .../cases/associations/has_many_associations_test.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 169e1a5449..b02653bbcc 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -745,35 +745,35 @@ class HasManyAssociationsTest < ActiveRecord::TestCase firm = Firm.all.merge!(order: "id").first collection = firm.clients - original_object_id = collection.first.object_id - assert_equal original_object_id, collection.first.object_id, "Expected second call to #first to cache the same object" + original_object = collection.first + assert_same original_object, collection.first, "Expected second call to #first to cache the same object" # It should return a different object, since the association has been reloaded - assert_not_equal original_object_id, firm.clients.first.object_id, "Expected #first to return a new object" + assert_not_same original_object, firm.clients.first, "Expected #first to return a new object" end def test_find_first_after_reset firm = Firm.all.merge!(order: "id").first collection = firm.clients - original_object_id = collection.first.object_id - assert_equal original_object_id, collection.first.object_id, "Expected second call to #first to cache the same object" + original_object = collection.first + assert_same original_object, collection.first, "Expected second call to #first to cache the same object" collection.reset # It should return a different object, since the association has been reloaded - assert_not_equal original_object_id, collection.first.object_id, "Expected #first after #reload to return a new object" + assert_not_same original_object, collection.first, "Expected #first after #reset to return a new object" end def test_find_first_after_reload firm = Firm.all.merge!(order: "id").first collection = firm.clients - original_object_id = collection.first.object_id - assert_equal original_object_id, collection.first.object_id, "Expected second call to #first to cache the same object" - collection.reset + original_object = collection.first + assert_same original_object, collection.first, "Expected second call to #first to cache the same object" + collection.reload # It should return a different object, since the association has been reloaded - assert_not_equal original_object_id, collection.first.object_id, "Expected #first after #reload to return a new object" + assert_not_same original_object, collection.first, "Expected #first after #reload to return a new object" end def test_find_all_with_include_and_conditions -- cgit v1.2.3 From bf3f2010003326a42d86a88425e3c66242c2f2f1 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 28 Jun 2017 21:59:28 +0900 Subject: Fix `ids_reader` to respect case sensitive primary key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ```ruby car = Car.create!(name: "Tofaş") # Before car.bulb_ids # => SELECT "bulbs".ID FROM "bulbs" WHERE "bulbs"."name" = $1 AND "bulbs"."car_id" = $2 [["name", "defaulty"], ["car_id", 3]] # After car.bulb_ids # => SELECT "bulbs"."ID" FROM "bulbs" WHERE "bulbs"."name" = $1 AND "bulbs"."car_id" = $2 [["name", "defaulty"], ["car_id", 3]] ``` --- .../lib/active_record/associations/collection_association.rb | 5 +---- activerecord/test/schema/schema.rb | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index 0cb17b47e8..583ee11907 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -44,10 +44,7 @@ module ActiveRecord if loaded? target.pluck(reflection.association_primary_key) else - @association_ids ||= ( - column = "#{reflection.quoted_table_name}.#{reflection.association_primary_key}" - scope.pluck(column) - ) + @association_ids ||= scope.pluck(reflection.association_primary_key) end end diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index d7ceb6d4ef..f534e9c00e 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -107,7 +107,7 @@ ActiveRecord::Schema.define do t.boolean :has_fun, null: false, default: false end - create_table :bulbs, force: true do |t| + create_table :bulbs, primary_key: "ID", force: true do |t| t.integer :car_id t.string :name t.boolean :frickinawesome, default: false -- cgit v1.2.3 From daec73aa429c37ea3c10d7628922697665776127 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 29 Jun 2017 01:02:18 +0900 Subject: Add a test case for unscoping `default_scope` in associations Unscoping `default_scope` in associations has already supported (#17360 for preloading, c9cf8b8 for eager loading). Fixes #20679. Closes #16531. --- activerecord/test/cases/associations/has_many_associations_test.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 169e1a5449..dab3d1b740 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -2354,8 +2354,9 @@ class HasManyAssociationsTest < ActiveRecord::TestCase car = Car.create! bulb = Bulb.create! name: "other", car: car - assert_equal bulb, Car.find(car.id).all_bulbs.first - assert_equal bulb, Car.includes(:all_bulbs).find(car.id).all_bulbs.first + assert_equal [bulb], Car.find(car.id).all_bulbs + assert_equal [bulb], Car.includes(:all_bulbs).find(car.id).all_bulbs + assert_equal [bulb], Car.eager_load(:all_bulbs).find(car.id).all_bulbs end test "raises RecordNotDestroyed when replaced child can't be destroyed" do -- cgit v1.2.3 From eacec5defe89dd9593d44f4831aa861a2e0e55d4 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 25 Jun 2017 20:58:20 +0900 Subject: Don't passing `klass.connection` to `AssociationScope` Passing `klass.connection` is redundant because `AssociationScope` is passed an association itself and an association has `klass`. --- activerecord/lib/active_record/associations/association.rb | 2 +- activerecord/lib/active_record/associations/association_scope.rb | 8 ++++---- .../lib/active_record/associations/collection_association.rb | 2 +- .../lib/active_record/associations/singular_association.rb | 2 +- activerecord/test/cases/associations/association_scope_test.rb | 3 +-- 5 files changed, 8 insertions(+), 9 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb index 5c45187d8f..44cf1f8915 100644 --- a/activerecord/lib/active_record/associations/association.rb +++ b/activerecord/lib/active_record/associations/association.rb @@ -94,7 +94,7 @@ module ActiveRecord # actually gets built. def association_scope if klass - @association_scope ||= AssociationScope.scope(self, klass.connection) + @association_scope ||= AssociationScope.scope(self) end end diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb index 1744dc785f..6ef225b725 100644 --- a/activerecord/lib/active_record/associations/association_scope.rb +++ b/activerecord/lib/active_record/associations/association_scope.rb @@ -1,8 +1,8 @@ module ActiveRecord module Associations class AssociationScope #:nodoc: - def self.scope(association, connection) - INSTANCE.scope(association, connection) + def self.scope(association) + INSTANCE.scope(association) end def self.create(&block) @@ -16,12 +16,12 @@ module ActiveRecord INSTANCE = create - def scope(association, connection) + def scope(association) klass = association.klass reflection = association.reflection scope = klass.unscoped owner = association.owner - alias_tracker = AliasTracker.create connection, association.klass.table_name + alias_tracker = AliasTracker.create(klass.connection, klass.table_name) chain_head, chain_tail = get_chain(reflection, association, alias_tracker) scope.extending! reflection.extensions diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index 0cb17b47e8..c5ed6d41dd 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -307,7 +307,7 @@ module ActiveRecord sc = reflection.association_scope_cache(conn, owner) do StatementCache.create(conn) { |params| as = AssociationScope.create { params.bind } - target_scope.merge as.scope(self, conn) + target_scope.merge!(as.scope(self)) } end diff --git a/activerecord/lib/active_record/associations/singular_association.rb b/activerecord/lib/active_record/associations/singular_association.rb index 2b426da607..f8bbe4c2ed 100644 --- a/activerecord/lib/active_record/associations/singular_association.rb +++ b/activerecord/lib/active_record/associations/singular_association.rb @@ -43,7 +43,7 @@ module ActiveRecord sc = reflection.association_scope_cache(conn, owner) do StatementCache.create(conn) { |params| as = AssociationScope.create { params.bind } - target_scope.merge(as.scope(self, conn)).limit(1) + target_scope.merge!(as.scope(self)).limit(1) } end diff --git a/activerecord/test/cases/associations/association_scope_test.rb b/activerecord/test/cases/associations/association_scope_test.rb index c322333f6d..c54542ff7b 100644 --- a/activerecord/test/cases/associations/association_scope_test.rb +++ b/activerecord/test/cases/associations/association_scope_test.rb @@ -6,8 +6,7 @@ module ActiveRecord module Associations class AssociationScopeTest < ActiveRecord::TestCase test "does not duplicate conditions" do - scope = AssociationScope.scope(Author.new.association(:welcome_posts), - Author.connection) + scope = AssociationScope.scope(Author.new.association(:welcome_posts)) binds = scope.where_clause.binds.map(&:value) assert_equal binds.uniq, binds end -- cgit v1.2.3 From 1b4360dea81b0c04589a62b8af7c555cfc0509ca Mon Sep 17 00:00:00 2001 From: Tsukasa OISHI Date: Wed, 28 Jun 2017 14:12:12 +0900 Subject: Enable query cache if set a configurations ActiveRecord query cache is available when a connection is connected. Therefore, query cache is unavailable when entering the ActiveRecord::Base.cache block without being connected. ```ruby ActiveRecord::Base.cache do Task.find(1) # access to database. Task.find(1) # access to database. unavailable query cache end ``` If we use query cache with batch script etc, we need to connect before that. ```ruby Task.connection ActiveRecord::Base.cache do Task.find(1) # access to database. Task.find(1) # available query cache end ``` Before version 3.1, query cache had been enabled if a configuration was set up. In order to solve the `DATABASE_URL` issue(#8074), ActiveRecord has checked whether a connection is connected or not. Today, ActiveRecord.configurations respect `DATABASE_URL`. https://github.com/rails/rails/blob/master/activerecord/lib/active_record/core.rb#L46 --- activerecord/CHANGELOG.md | 5 +++++ activerecord/lib/active_record/query_cache.rb | 12 ++++++------ activerecord/test/cases/query_cache_test.rb | 16 ++-------------- 3 files changed, 13 insertions(+), 20 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index f780029a18..bbf23c90df 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,8 @@ +* Query cache was unavailable when entering the ActiveRecord::Base.cache block + without being connected. + + *Tsukasa Oishi* + * Previously, when building records using a `has_many :through` association, if the child records were deleted before the parent was saved, they would still be persisted. Now, if child records are deleted before the parent is saved diff --git a/activerecord/lib/active_record/query_cache.rb b/activerecord/lib/active_record/query_cache.rb index ec246e97bc..e4c2e1f86f 100644 --- a/activerecord/lib/active_record/query_cache.rb +++ b/activerecord/lib/active_record/query_cache.rb @@ -5,20 +5,20 @@ module ActiveRecord # Enable the query cache within the block if Active Record is configured. # If it's not, it will execute the given block. def cache(&block) - if connected? - connection.cache(&block) - else + if configurations.empty? yield + else + connection.cache(&block) end end # Disable the query cache within the block if Active Record is configured. # If it's not, it will execute the given block. def uncached(&block) - if connected? - connection.uncached(&block) - else + if configurations.empty? yield + else + connection.uncached(&block) end end end diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb index c2d40f2940..3962453f75 100644 --- a/activerecord/test/cases/query_cache_test.rb +++ b/activerecord/test/cases/query_cache_test.rb @@ -321,18 +321,7 @@ class QueryCacheTest < ActiveRecord::TestCase end end - def test_cache_is_available_when_connection_is_connected - conf = ActiveRecord::Base.configurations - - ActiveRecord::Base.configurations = {} - Task.cache do - assert_queries(1) { Task.find(1); Task.find(1) } - end - ensure - ActiveRecord::Base.configurations = conf - end - - def test_cache_is_not_available_when_using_a_not_connected_connection + def test_cache_is_available_when_using_a_not_connected_connection with_temporary_connection_pool do spec_name = Task.connection_specification_name conf = ActiveRecord::Base.configurations["arunit"].merge("name" => "test2") @@ -349,8 +338,7 @@ class QueryCacheTest < ActiveRecord::TestCase end ActiveRecord::FixtureSet.create_fixtures(self.class.fixture_path, ["tasks"], {}, ActiveRecord::Base) end - Task.connection # warmup postgresql connection setup queries - assert_queries(2) { Task.find(1); Task.find(1) } + assert_queries(1) { Task.find(1); Task.find(1) } ensure ActiveRecord::Base.connection_handler.remove_connection(Task.connection_specification_name) Task.connection_specification_name = spec_name -- cgit v1.2.3 From b084fe9054759263329cfe36f2d4de13567d67f6 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 28 Jun 2017 20:43:13 +0900 Subject: Fix eager loading to respect `store_full_sti_class` setting --- activerecord/CHANGELOG.md | 4 ++++ activerecord/lib/active_record/reflection.rb | 2 +- .../eager_load_includes_full_sti_class_test.rb | 27 ++++++++++++++-------- 3 files changed, 22 insertions(+), 11 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index f780029a18..c4c1988500 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,7 @@ +* Fix eager loading to respect `store_full_sti_class` setting. + + *Ryuta Kamizono* + * Previously, when building records using a `has_many :through` association, if the child records were deleted before the parent was saved, they would still be persisted. Now, if child records are deleted before the parent is saved diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 3d3ec862a3..72e0fcbdf4 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -200,7 +200,7 @@ module ActiveRecord end if type - klass_scope.where!(type => foreign_klass.base_class.name) + klass_scope.where!(type => foreign_klass.base_class.sti_name) end scope_chain_items.inject(klass_scope, &:merge!) diff --git a/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb b/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb index 4f0fe3236e..61f39b4136 100644 --- a/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb +++ b/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb @@ -11,25 +11,32 @@ end class EagerLoadIncludeFullStiClassNamesTest < ActiveRecord::TestCase def setup - generate_test_objects - end - - def generate_test_objects post = Namespaced::Post.create(title: "Great stuff", body: "This is not", author_id: 1) - Tagging.create(taggable: post) + @tagging = Tagging.create(taggable: post) + @old = ActiveRecord::Base.store_full_sti_class end - def test_class_names - old = ActiveRecord::Base.store_full_sti_class + def teardown + ActiveRecord::Base.store_full_sti_class = @old + end + def test_class_names_with_includes ActiveRecord::Base.store_full_sti_class = false post = Namespaced::Post.includes(:tagging).find_by_title("Great stuff") assert_nil post.tagging ActiveRecord::Base.store_full_sti_class = true post = Namespaced::Post.includes(:tagging).find_by_title("Great stuff") - assert_instance_of Tagging, post.tagging - ensure - ActiveRecord::Base.store_full_sti_class = old + assert_equal @tagging, post.tagging + end + + def test_class_names_with_eager_load + ActiveRecord::Base.store_full_sti_class = false + post = Namespaced::Post.eager_load(:tagging).find_by_title("Great stuff") + assert_nil post.tagging + + ActiveRecord::Base.store_full_sti_class = true + post = Namespaced::Post.eager_load(:tagging).find_by_title("Great stuff") + assert_equal @tagging, post.tagging end end -- cgit v1.2.3 From 4cf41833edda251dc9b49dfe197eebd144d8993e Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 29 Jun 2017 03:11:15 +0900 Subject: Show query cache keys in `test_middleware_caches` `test_middleware_caches` also failed same as #29600. https://travis-ci.org/rails/rails/jobs/248017174#L487-L489 --- activerecord/test/cases/query_cache_test.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb index c2d40f2940..d888a29c60 100644 --- a/activerecord/test/cases/query_cache_test.rb +++ b/activerecord/test/cases/query_cache_test.rb @@ -150,7 +150,8 @@ class QueryCacheTest < ActiveRecord::TestCase mw = middleware { |env| Task.find 1 Task.find 1 - assert_equal 1, ActiveRecord::Base.connection.query_cache.length + query_cache = ActiveRecord::Base.connection.query_cache + assert_equal 1, query_cache.length, query_cache.keys [200, {}, nil] } mw.call({}) -- cgit v1.2.3 From 425f2cacafc522bb0aa426a0a4bc92c1237160aa Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 29 Jun 2017 02:11:28 +0900 Subject: Remove delegating to arel in a relation The delegation was needed since passing `relation` with `relation.bound_attributes`. It should use `relation.arel` in that case. --- .../lib/active_record/connection_adapters/abstract/query_cache.rb | 1 + activerecord/lib/active_record/relation/calculations.rb | 2 +- activerecord/lib/active_record/relation/delegation.rb | 2 -- activerecord/lib/active_record/relation/finder_methods.rb | 8 +++----- activerecord/test/cases/relations_test.rb | 2 +- activerecord/test/models/post.rb | 1 + 6 files changed, 7 insertions(+), 9 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb index e53ba4e666..33695c0537 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb @@ -123,6 +123,7 @@ module ActiveRecord # If arel is locked this is a SELECT ... FOR UPDATE or somesuch. Such # queries should not be cached. def locked?(arel) + arel = arel.arel if arel.is_a?(Relation) arel.respond_to?(:locked) && arel.locked end diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index c562f214c9..24b8be0242 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -311,7 +311,7 @@ module ActiveRecord relation.group_values = group_fields relation.select_values = select_values - calculated_data = @klass.connection.select_all(relation, nil, relation.bound_attributes) + calculated_data = @klass.connection.select_all(relation.arel, nil, relation.bound_attributes) if association key_ids = calculated_data.collect { |row| row[group_aliases.first] } diff --git a/activerecord/lib/active_record/relation/delegation.rb b/activerecord/lib/active_record/relation/delegation.rb index dada0fddf8..8b4dd25689 100644 --- a/activerecord/lib/active_record/relation/delegation.rb +++ b/activerecord/lib/active_record/relation/delegation.rb @@ -44,8 +44,6 @@ module ActiveRecord delegate :table_name, :quoted_table_name, :primary_key, :quoted_primary_key, :connection, :columns_hash, to: :klass - delegate :ast, :locked, to: :arel - module ClassSpecificRelation # :nodoc: extend ActiveSupport::Concern diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 1d661fa8ed..47f42bf4ca 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -316,7 +316,7 @@ module ActiveRecord relation = construct_relation_for_exists(relation, conditions) - connection.select_value(relation, "#{name} Exists", relation.bound_attributes) ? true : false + connection.select_value(relation.arel, "#{name} Exists", relation.bound_attributes) ? true : false rescue ::RangeError false end @@ -377,8 +377,7 @@ module ActiveRecord if ActiveRecord::NullRelation === relation [] else - arel = relation.arel - rows = connection.select_all(arel, "SQL", relation.bound_attributes) + rows = connection.select_all(relation.arel, "SQL", relation.bound_attributes) join_dependency.instantiate(rows, aliases) end end @@ -425,9 +424,8 @@ module ActiveRecord "#{quoted_table_name}.#{quoted_primary_key}", relation.order_values) relation = relation.except(:select).select(values).distinct! - arel = relation.arel - id_rows = @klass.connection.select_all(arel, "SQL", relation.bound_attributes) + id_rows = @klass.connection.select_all(relation.arel, "SQL", relation.bound_attributes) id_rows.map { |row| row[primary_key] } end diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 5f36e4ec5d..84ccfbf5d5 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -2002,7 +2002,7 @@ class RelationTest < ActiveRecord::TestCase end def test_locked_should_not_build_arel - posts = Post.lock + posts = Post.locked assert posts.locked? assert_nothing_raised { posts.lock!(false) } end diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb index 4c913b3b72..ed64e0ee52 100644 --- a/activerecord/test/models/post.rb +++ b/activerecord/test/models/post.rb @@ -22,6 +22,7 @@ class Post < ActiveRecord::Base scope :ranked_by_comments, -> { order("comments_count DESC") } scope :limit_by, lambda { |l| limit(l) } + scope :locked, -> { lock } belongs_to :author belongs_to :readonly_author, -> { readonly }, class_name: "Author", foreign_key: :author_id -- cgit v1.2.3 From ede8da4b26bd24aec746dcd8efa864b2e43e075e Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Mon, 27 Mar 2017 19:40:54 +0900 Subject: Use `quote` method rather than single quotes to identifiers in SQL Because identifiers in SQL could include a single quote. Related #24950, #26784. --- .../connection_adapters/abstract_mysql_adapter.rb | 2 +- .../active_record/connection_adapters/mysql/schema_dumper.rb | 2 +- .../connection_adapters/postgresql/database_statements.rb | 4 ++++ .../connection_adapters/postgresql/schema_statements.rb | 12 ++++++------ .../active_record/connection_adapters/postgresql_adapter.rb | 5 ----- 5 files changed, 12 insertions(+), 13 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index c42e80ea2c..183f0f3c1b 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -694,7 +694,7 @@ module ActiveRecord auto_increment: column.auto_increment? } - current_type = select_one("SHOW COLUMNS FROM #{quote_table_name(table_name)} LIKE '#{column_name}'", "SCHEMA")["Type"] + current_type = select_one("SHOW COLUMNS FROM #{quote_table_name(table_name)} LIKE #{quote(column_name)}", "SCHEMA")["Type"] td = create_table_definition(table_name) cd = td.new_column_definition(new_column_name, current_type, options) schema_creation.accept(ChangeColumnDefinition.new(cd, column.name)) diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb index e2ba0ba1a0..f21b2546de 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb @@ -47,7 +47,7 @@ module ActiveRecord def schema_collation(column) if column.collation && table_name = column.table_name @table_collation_cache ||= {} - @table_collation_cache[table_name] ||= select_one("SHOW TABLE STATUS LIKE '#{table_name}'")["Collation"] + @table_collation_cache[table_name] ||= select_one("SHOW TABLE STATUS LIKE #{quote(table_name)}")["Collation"] column.collation.inspect if column.collation != @table_collation_cache[table_name] end end diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb index ac5efbebeb..ebf1715ed0 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb @@ -147,6 +147,10 @@ module ActiveRecord end private + # Returns the current ID of a table's sequence. + def last_insert_id_result(sequence_name) + exec_query("SELECT currval(#{quote(sequence_name)})", "SQL") + end def suppress_composite_primary_key(pk) pk unless pk.is_a?(Array) 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 cb45d7ba6b..7aa034f901 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb @@ -257,7 +257,7 @@ module ActiveRecord end def serial_sequence(table, column) - select_value("SELECT pg_get_serial_sequence('#{table}', '#{column}')", "SCHEMA") + select_value("SELECT pg_get_serial_sequence(#{quote(table)}, #{quote(column)})", "SCHEMA") end # Sets the sequence of a table's primary key to the specified value. @@ -268,7 +268,7 @@ module ActiveRecord if sequence quoted_sequence = quote_table_name(sequence) - select_value("SELECT setval('#{quoted_sequence}', #{value})", "SCHEMA") + select_value("SELECT setval(#{quote(quoted_sequence)}, #{value})", "SCHEMA") else @logger.warn "#{table} has primary key #{pk} with no default sequence." if @logger end @@ -293,14 +293,14 @@ module ActiveRecord max_pk = select_value("select MAX(#{quote_column_name pk}) from #{quote_table_name(table)}") if max_pk.nil? if postgresql_version >= 100000 - minvalue = select_value("SELECT seqmin from pg_sequence where seqrelid = '#{quoted_sequence}'::regclass") + minvalue = select_value("SELECT seqmin from pg_sequence where seqrelid = #{quote(quoted_sequence)}::regclass") else minvalue = select_value("SELECT min_value FROM #{quoted_sequence}") end end select_value(<<-end_sql, "SCHEMA") - SELECT setval('#{quoted_sequence}', #{max_pk ? max_pk : minvalue}, #{max_pk ? true : false}) + SELECT setval(#{quote(quoted_sequence)}, #{max_pk ? max_pk : minvalue}, #{max_pk ? true : false}) end_sql end end @@ -325,7 +325,7 @@ module ActiveRecord AND seq.relnamespace = nsp.oid AND cons.contype = 'p' AND dep.classid = 'pg_class'::regclass - AND dep.refobjid = '#{quote_table_name(table)}'::regclass + AND dep.refobjid = #{quote(quote_table_name(table))}::regclass end_sql if result.nil? || result.empty? @@ -343,7 +343,7 @@ module ActiveRecord JOIN pg_attrdef def ON (adrelid = attrelid AND adnum = attnum) JOIN pg_constraint cons ON (conrelid = adrelid AND adnum = conkey[1]) JOIN pg_namespace nsp ON (t.relnamespace = nsp.oid) - WHERE t.oid = '#{quote_table_name(table)}'::regclass + WHERE t.oid = #{quote(quote_table_name(table))}::regclass AND cons.contype = 'p' AND pg_get_expr(def.adbin, def.adrelid) ~* 'nextval|uuid_generate' end_sql diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 5287dd6a51..99edbe486f 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -723,11 +723,6 @@ module ActiveRecord end end - # Returns the current ID of a table's sequence. - def last_insert_id_result(sequence_name) - exec_query("SELECT currval('#{sequence_name}')", "SQL") - end - # Returns the list of a table's column names, data types, and default values. # # The underlying query is roughly: -- cgit v1.2.3 From 4aa4a449e0de9d01067f9f74ba1ad47829c2715d Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 29 Jun 2017 05:35:34 +0900 Subject: Remove unused `aliased_table_name` in `Association` `aliased_table_name` in `Association` was added at a3502c4. `aliased_table_name` in `JoinDependency` (added at 55854c4) is used, but it looks like that added one in `Association` is never used from the beginning. --- activerecord/lib/active_record/associations/association.rb | 8 -------- .../test/cases/associations/belongs_to_associations_test.rb | 1 - 2 files changed, 9 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb index 44cf1f8915..1138ae3462 100644 --- a/activerecord/lib/active_record/associations/association.rb +++ b/activerecord/lib/active_record/associations/association.rb @@ -30,14 +30,6 @@ module ActiveRecord reset_scope end - # Returns the name of the table of the associated class: - # - # post.comments.aliased_table_name # => "comments" - # - def aliased_table_name - klass.table_name - end - # Resets the \loaded flag to +false+ and sets the \target to +nil+. def reset @loaded = false diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index c8b26232b6..a727cc6e60 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -380,7 +380,6 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase sponsor.sponsorable = Member.new name: "Bert" assert_equal Member, sponsor.association(:sponsorable).send(:klass) - assert_equal "members", sponsor.association(:sponsorable).aliased_table_name end def test_with_polymorphic_and_condition -- cgit v1.2.3 From 99912ed92635600eb6b03959c33638cb62f1bdca Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 1 Jun 2017 09:35:26 +0900 Subject: Fix to scoping is correctly restored This regression was caused by #23004. If STI subclass is using scoping in parent class scoping, `current_scope` in subclass is never restored. I fixed to restore `current_scope` to previous value correctly. --- activerecord/lib/active_record/relation.rb | 2 +- activerecord/lib/active_record/scoping.rb | 7 ++++--- activerecord/test/cases/scoping/relation_scoping_test.rb | 9 +++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 133c1a6318..52f5d5f3e3 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -333,7 +333,7 @@ module ActiveRecord # Please check unscoped if you want to remove all previous scopes (including # the default_scope) during the execution of a block. def scoping - previous, klass.current_scope = klass.current_scope, self + previous, klass.current_scope = klass.current_scope(true), self yield ensure klass.current_scope = previous diff --git a/activerecord/lib/active_record/scoping.rb b/activerecord/lib/active_record/scoping.rb index 7c00e7e4ed..94e0ef6724 100644 --- a/activerecord/lib/active_record/scoping.rb +++ b/activerecord/lib/active_record/scoping.rb @@ -10,8 +10,8 @@ module ActiveRecord end module ClassMethods - def current_scope #:nodoc: - ScopeRegistry.value_for(:current_scope, self) + def current_scope(skip_inherited_scope = false) # :nodoc: + ScopeRegistry.value_for(:current_scope, self, skip_inherited_scope) end def current_scope=(scope) #:nodoc: @@ -75,8 +75,9 @@ module ActiveRecord end # Obtains the value for a given +scope_type+ and +model+. - def value_for(scope_type, model) + def value_for(scope_type, model, skip_inherited_scope = false) raise_invalid_scope_type!(scope_type) + return @registry[scope_type][model.name] if skip_inherited_scope klass = model base = model.base_class while klass <= base diff --git a/activerecord/test/cases/scoping/relation_scoping_test.rb b/activerecord/test/cases/scoping/relation_scoping_test.rb index 8535be8402..10553bf057 100644 --- a/activerecord/test/cases/scoping/relation_scoping_test.rb +++ b/activerecord/test/cases/scoping/relation_scoping_test.rb @@ -229,6 +229,15 @@ class RelationScopingTest < ActiveRecord::TestCase end end + def test_scoping_is_correctly_restored + Comment.unscoped do + SpecialComment.unscoped.created + end + + assert_nil Comment.current_scope + assert_nil SpecialComment.current_scope + end + def test_circular_joins_with_scoping_does_not_crash posts = Post.joins(comments: :post).scoping do Post.first(10) -- cgit v1.2.3 From abbc8351cd19f676476242bd6a0836b83dc3f0f0 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 29 Jun 2017 16:25:32 +0900 Subject: Should use the same connection in using query cache `test_cache_is_available_when_using_a_not_connected_connection` is always failed if running only the test since #29609. ``` % ARCONN=mysql2 be ruby -w -Itest test/cases/query_cache_test.rb -n test_cache_is_available_when_using_a_not_connected_connection Using mysql2 Run options: -n test_cache_is_available_when_using_a_not_connected_connection --seed 15043 F Finished in 0.070519s, 14.1806 runs/s, 28.3612 assertions/s. 1) Failure: QueryCacheTest#test_cache_is_available_when_using_a_not_connected_connection [test/cases/query_cache_test.rb:336]: 2 instead of 1 queries were executed. Queries: SELECT `tasks`.* FROM `tasks` WHERE `tasks`.`id` = ? LIMIT ? SET NAMES utf8 COLLATE utf8_unicode_ci, @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483. Expected: 1 Actual: 2 1 runs, 2 assertions, 1 failures, 0 errors, 0 skips ``` This failure is due to `LogSubscriber` will use not connected `ActiveRecord::Base.connection` even if `Task.connection` is connected. I fixed to always pass `type_casted_binds` to log subscriber to avoid the issue. --- .../lib/active_record/connection_adapters/abstract/query_cache.rb | 1 + activerecord/lib/active_record/log_subscriber.rb | 7 +++---- activerecord/test/cases/query_cache_test.rb | 8 +------- 3 files changed, 5 insertions(+), 11 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb index 33695c0537..c352ddfc11 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb @@ -108,6 +108,7 @@ module ActiveRecord "sql.active_record", sql: sql, binds: binds, + type_casted_binds: -> { type_casted_binds(binds) }, name: name, connection_id: object_id, cached: true, diff --git a/activerecord/lib/active_record/log_subscriber.rb b/activerecord/lib/active_record/log_subscriber.rb index 2297c77835..e39ca5f6dc 100644 --- a/activerecord/lib/active_record/log_subscriber.rb +++ b/activerecord/lib/active_record/log_subscriber.rb @@ -29,7 +29,7 @@ module ActiveRecord binds = nil unless (payload[:binds] || []).empty? - casted_params = type_casted_binds(payload[:binds], payload[:type_casted_binds]) + casted_params = type_casted_binds(payload[:type_casted_binds]) binds = " " + payload[:binds].zip(casted_params).map { |attr, value| render_bind(attr, value) }.inspect @@ -42,9 +42,8 @@ module ActiveRecord end private - - def type_casted_binds(binds, casted_binds) - casted_binds || ActiveRecord::Base.connection.type_casted_binds(binds) + def type_casted_binds(casted_binds) + casted_binds.respond_to?(:call) ? casted_binds.call : casted_binds end def render_bind(attr, value) diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb index 68d18e6471..b018a7b6c0 100644 --- a/activerecord/test/cases/query_cache_test.rb +++ b/activerecord/test/cases/query_cache_test.rb @@ -323,6 +323,7 @@ class QueryCacheTest < ActiveRecord::TestCase end def test_cache_is_available_when_using_a_not_connected_connection + skip "In-Memory DB can't test for using a not connected connection" if in_memory_db? with_temporary_connection_pool do spec_name = Task.connection_specification_name conf = ActiveRecord::Base.configurations["arunit"].merge("name" => "test2") @@ -332,13 +333,6 @@ class QueryCacheTest < ActiveRecord::TestCase Task.cache do begin - if in_memory_db? - Task.connection.create_table :tasks do |t| - t.datetime :starting - t.datetime :ending - end - ActiveRecord::FixtureSet.create_fixtures(self.class.fixture_path, ["tasks"], {}, ActiveRecord::Base) - end assert_queries(1) { Task.find(1); Task.find(1) } ensure ActiveRecord::Base.connection_handler.remove_connection(Task.connection_specification_name) -- cgit v1.2.3 From d9fca84d218f0ed784c7bf6470df42d41838e507 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sat, 6 May 2017 06:02:01 +0900 Subject: Deprecate delegating to `arel` in `Relation` Active Record doesn't rely delegating to `arel` in the internal since 425f2ca. The delegation is a lower priority than delegating to `klass`, so it is pretty unclear which method is delegated to `arel`. For example, `bind_values` method was removed at b06f64c (a series of changes https://github.com/rails/rails/compare/79f71d3...b06f64c). But a relation still could respond to the method because `arel` also have the same named method (#28976). Removing the delegation will achieve predictable behavior. --- activerecord/CHANGELOG.md | 4 ++++ activerecord/lib/active_record/relation/delegation.rb | 2 ++ activerecord/test/cases/relation/delegation_test.rb | 15 +++++++++++++++ 3 files changed, 21 insertions(+) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 7e8ca51f25..824e9d4258 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,7 @@ +* Deprecate delegating to `arel` in `Relation`. + + *Ryuta Kamizono* + * Fix eager loading to respect `store_full_sti_class` setting. *Ryuta Kamizono* diff --git a/activerecord/lib/active_record/relation/delegation.rb b/activerecord/lib/active_record/relation/delegation.rb index 0e88ef4c7e..48c4dcdef4 100644 --- a/activerecord/lib/active_record/relation/delegation.rb +++ b/activerecord/lib/active_record/relation/delegation.rb @@ -89,6 +89,8 @@ module ActiveRecord self.class.delegate_to_scoped_klass(method) scoping { @klass.public_send(method, *args, &block) } elsif arel.respond_to?(method) + ActiveSupport::Deprecation.warn \ + "Delegating #{method} to arel is deprecated and will be removed in Rails 6.0." self.class.delegate method, to: :arel arel.public_send(method, *args, &block) else diff --git a/activerecord/test/cases/relation/delegation_test.rb b/activerecord/test/cases/relation/delegation_test.rb index cb6e4d76d3..3b15f051b2 100644 --- a/activerecord/test/cases/relation/delegation_test.rb +++ b/activerecord/test/cases/relation/delegation_test.rb @@ -21,8 +21,22 @@ module ActiveRecord end end + module DeprecatedArelDelegationTests + AREL_METHODS = [ + :with, :orders, :froms, :project, :projections, :taken, :constraints, :exists, :locked, :where_sql, + :ast, :source, :join_sources, :to_dot, :bind_values, :create_insert, :create_true, :create_false + ] + + def test_deprecate_arel_delegation + AREL_METHODS.each do |method| + assert_deprecated { target.public_send(method) } + end + end + end + class DelegationAssociationTest < ActiveRecord::TestCase include DelegationWhitelistTests + include DeprecatedArelDelegationTests fixtures :posts @@ -33,6 +47,7 @@ module ActiveRecord class DelegationRelationTest < ActiveRecord::TestCase include DelegationWhitelistTests + include DeprecatedArelDelegationTests fixtures :comments -- cgit v1.2.3 From 1d264f0bcd5081dcb4e5049a8124706f7623e63b Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 29 Jun 2017 23:33:11 +0900 Subject: Fix the next version of Rails from 5.3 to 6.0 --- activerecord/lib/active_record/relation/calculations.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 24b8be0242..8a54f8f2c3 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -41,7 +41,7 @@ module ActiveRecord unless column_name.nil? ActiveSupport::Deprecation.warn \ "When `count' is called with a block, it ignores other arguments. " \ - "This behavior is now deprecated and will result in an ArgumentError in Rails 5.3." + "This behavior is now deprecated and will result in an ArgumentError in Rails 6.0." end return super() @@ -86,7 +86,7 @@ module ActiveRecord unless column_name.nil? ActiveSupport::Deprecation.warn \ "When `sum' is called with a block, it ignores other arguments. " \ - "This behavior is now deprecated and will result in an ArgumentError in Rails 5.3." + "This behavior is now deprecated and will result in an ArgumentError in Rails 6.0." end return super() -- cgit v1.2.3 From 131ed24f5ef41f5470e83fb66cfff61f635bf24d Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Fri, 30 Jun 2017 02:29:52 +0900 Subject: Should be clear `@association_ids` when joined newly associated record Fixes #29627. --- .../active_record/associations/collection_association.rb | 13 +++++++++++-- .../test/cases/associations/has_many_associations_test.rb | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index bbf3dbb75e..a49fb155ee 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -66,6 +66,7 @@ module ActiveRecord def reset super @target = [] + @association_ids = nil end def find(*args) @@ -355,7 +356,10 @@ module ActiveRecord transaction do add_to_target(build_record(attributes)) do |record| yield(record) if block_given? - insert_record(record, true, raise) { @_was_loaded = loaded? } + insert_record(record, true, raise) { + @_was_loaded = loaded? + @association_ids = nil + } end end end @@ -428,7 +432,12 @@ module ActiveRecord records.each do |record| raise_on_type_mismatch!(record) add_to_target(record) do - result &&= insert_record(record, true, raise) { @_was_loaded = loaded? } unless owner.new_record? + unless owner.new_record? + result &&= insert_record(record, true, raise) { + @_was_loaded = loaded? + @association_ids = nil + } + end end end diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index a936017ae3..d7515a4c18 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -2544,6 +2544,11 @@ class HasManyAssociationsTest < ActiveRecord::TestCase assert_equal [bulb.id], car.bulb_ids assert_no_queries { car.bulb_ids } + + bulb2 = car.bulbs.create! + + assert_equal [bulb.id, bulb2.id], car.bulb_ids + assert_no_queries { car.bulb_ids } end def test_loading_association_in_validate_callback_doesnt_affect_persistence -- cgit v1.2.3 From 21d040f97d539fb292bd79453692dc02b19c23f0 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Fri, 30 Jun 2017 06:36:33 +0900 Subject: Don't cache queries for schema statements `test_middleware_caches` is sometimes failed since #29454. The failure is due to schema statements are affected by query caching. Bypassing query caching for schema statements to avoid the issue. --- .../abstract/database_statements.rb | 22 +++++++++--- .../abstract/schema_statements.rb | 12 +++---- .../connection_adapters/abstract_mysql_adapter.rb | 20 +++++------ .../mysql/database_statements.rb | 4 +++ .../connection_adapters/mysql/schema_dumper.rb | 4 +-- .../connection_adapters/postgresql/quoting.rb | 2 +- .../postgresql/schema_statements.rb | 40 ++++++++++------------ .../connection_adapters/postgresql_adapter.rb | 13 ++++--- .../sqlite3/schema_statements.rb | 2 +- .../connection_adapters/sqlite3_adapter.rb | 6 ++-- 10 files changed, 70 insertions(+), 55 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index af5314c1d6..879626b72a 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -51,9 +51,7 @@ module ActiveRecord # Returns a single value from a record def select_value(arel, name = nil, binds = []) - if result = select_rows(arel, name, binds).first - result.first - end + single_value_from_rows(select_rows(arel, name, binds)) end # Returns an array of the values of the first column in a select: @@ -68,6 +66,18 @@ module ActiveRecord select_all(arel, name, binds).rows end + def query_value(sql, name = nil) # :nodoc: + single_value_from_rows(query(sql, name)) + end + + def query_values(sql, name = nil) # :nodoc: + query(sql, name).map(&:first) + end + + def query(sql, name = nil) # :nodoc: + exec_query(sql, name).rows + end + # Executes the SQL statement in the context of this connection and returns # the raw result from the connection adapter. # Note: depending on your database connector, the result returned by this @@ -410,7 +420,11 @@ module ActiveRecord end def last_inserted_id(result) - row = result.rows.first + single_value_from_rows(result.rows) + end + + def single_value_from_rows(rows) + row = rows.first row && row.first end 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 22d7791dec..41d900733a 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -31,7 +31,7 @@ module ActiveRecord # Returns the relation names useable to back Active Record models. # For most adapters this means all #tables and #views. def data_sources - select_values(data_source_sql, "SCHEMA") + query_values(data_source_sql, "SCHEMA") rescue NotImplementedError tables | views end @@ -41,14 +41,14 @@ module ActiveRecord # data_source_exists?(:ebooks) # def data_source_exists?(name) - select_values(data_source_sql(name), "SCHEMA").any? if name.present? + query_values(data_source_sql(name), "SCHEMA").any? if name.present? rescue NotImplementedError data_sources.include?(name.to_s) end # Returns an array of table names defined in the database. def tables - select_values(data_source_sql(type: "BASE TABLE"), "SCHEMA") + query_values(data_source_sql(type: "BASE TABLE"), "SCHEMA") end # Checks to see if the table +table_name+ exists on the database. @@ -56,14 +56,14 @@ module ActiveRecord # table_exists?(:developers) # def table_exists?(table_name) - select_values(data_source_sql(table_name, type: "BASE TABLE"), "SCHEMA").any? if table_name.present? + query_values(data_source_sql(table_name, type: "BASE TABLE"), "SCHEMA").any? if table_name.present? rescue NotImplementedError tables.include?(table_name.to_s) end # Returns an array of view names defined in the database. def views - select_values(data_source_sql(type: "VIEW"), "SCHEMA") + query_values(data_source_sql(type: "VIEW"), "SCHEMA") end # Checks to see if the view +view_name+ exists on the database. @@ -71,7 +71,7 @@ module ActiveRecord # view_exists?(:ebooks) # def view_exists?(view_name) - select_values(data_source_sql(view_name, type: "VIEW"), "SCHEMA").any? if view_name.present? + query_values(data_source_sql(view_name, type: "VIEW"), "SCHEMA").any? if view_name.present? rescue NotImplementedError views.include?(view_name.to_s) end diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index 183f0f3c1b..6a907699e9 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -120,11 +120,11 @@ module ActiveRecord end def get_advisory_lock(lock_name, timeout = 0) # :nodoc: - select_value("SELECT GET_LOCK(#{quote(lock_name)}, #{timeout})") == 1 + query_value("SELECT GET_LOCK(#{quote(lock_name)}, #{timeout})") == 1 end def release_advisory_lock(lock_name) # :nodoc: - select_value("SELECT RELEASE_LOCK(#{quote(lock_name)})") == 1 + query_value("SELECT RELEASE_LOCK(#{quote(lock_name)})") == 1 end def native_database_types @@ -152,7 +152,7 @@ module ActiveRecord # REFERENTIAL INTEGRITY ==================================== def disable_referential_integrity #:nodoc: - old = select_value("SELECT @@FOREIGN_KEY_CHECKS") + old = query_value("SELECT @@FOREIGN_KEY_CHECKS") begin update("SET FOREIGN_KEY_CHECKS = 0") @@ -267,7 +267,7 @@ module ActiveRecord end def current_database - select_value "SELECT DATABASE() as db" + query_value("SELECT database()", "SCHEMA") end # Returns the database character set. @@ -287,7 +287,7 @@ module ActiveRecord def table_comment(table_name) # :nodoc: scope = quoted_scope(table_name) - select_value(<<-SQL.strip_heredoc, "SCHEMA") + query_value(<<-SQL.strip_heredoc, "SCHEMA") SELECT table_comment FROM information_schema.tables WHERE table_schema = #{scope[:schema]} @@ -393,7 +393,7 @@ module ActiveRecord scope = quoted_scope(table_name) - fk_info = select_all(<<-SQL.strip_heredoc, "SCHEMA") + fk_info = exec_query(<<-SQL.strip_heredoc, "SCHEMA") SELECT fk.referenced_table_name AS 'to_table', fk.referenced_column_name AS 'primary_key', fk.column_name AS 'column', @@ -470,7 +470,7 @@ module ActiveRecord # SHOW VARIABLES LIKE 'name' def show_variable(name) - select_value("SELECT @@#{name}", "SCHEMA") + query_value("SELECT @@#{name}", "SCHEMA") rescue ActiveRecord::StatementInvalid nil end @@ -480,7 +480,7 @@ module ActiveRecord scope = quoted_scope(table_name) - select_values(<<-SQL.strip_heredoc, "SCHEMA") + query_values(<<-SQL.strip_heredoc, "SCHEMA") SELECT column_name FROM information_schema.key_column_usage WHERE constraint_name = 'PRIMARY' @@ -694,7 +694,7 @@ module ActiveRecord auto_increment: column.auto_increment? } - current_type = select_one("SHOW COLUMNS FROM #{quote_table_name(table_name)} LIKE #{quote(column_name)}", "SCHEMA")["Type"] + current_type = exec_query("SHOW COLUMNS FROM #{quote_table_name(table_name)} LIKE #{quote(column_name)}", "SCHEMA").first["Type"] td = create_table_definition(table_name) cd = td.new_column_definition(new_column_name, current_type, options) schema_creation.accept(ChangeColumnDefinition.new(cd, column.name)) @@ -804,7 +804,7 @@ module ActiveRecord end def create_table_info(table_name) # :nodoc: - select_one("SHOW CREATE TABLE #{quote_table_name(table_name)}")["Create Table"] + exec_query("SHOW CREATE TABLE #{quote_table_name(table_name)}", "SCHEMA").first["Create Table"] end def arel_visitor diff --git a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb index 9f1021456b..bda482a00f 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb @@ -13,6 +13,10 @@ module ActiveRecord result end + def query(sql, name = nil) # :nodoc: + execute(sql, name).to_a + end + # Executes the SQL statement in the context of this connection. def execute(sql, name = nil) # make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb index f21b2546de..eff96e329f 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb @@ -47,7 +47,7 @@ module ActiveRecord def schema_collation(column) if column.collation && table_name = column.table_name @table_collation_cache ||= {} - @table_collation_cache[table_name] ||= select_one("SHOW TABLE STATUS LIKE #{quote(table_name)}")["Collation"] + @table_collation_cache[table_name] ||= exec_query("SHOW TABLE STATUS LIKE #{quote(table_name)}", "SCHEMA").first["Collation"] column.collation.inspect if column.collation != @table_collation_cache[table_name] end end @@ -64,7 +64,7 @@ module ActiveRecord " WHERE table_schema = #{scope[:schema]}" \ " AND table_name = #{scope[:name]}" \ " AND column_name = #{quote(column.name)}" - select_value(sql, "SCHEMA").inspect + query_value(sql, "SCHEMA").inspect end end end diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb index 44eb666965..ee4230c6f2 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb @@ -78,7 +78,7 @@ module ActiveRecord private def lookup_cast_type(sql_type) - super(select_value("SELECT #{quote(sql_type)}::regtype::oid", "SCHEMA").to_i) + super(query_value("SELECT #{quote(sql_type)}::regtype::oid", "SCHEMA").to_i) end def _quote(value) 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 7aa034f901..8a999a8429 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb @@ -60,7 +60,7 @@ module ActiveRecord # Returns true if schema exists. def schema_exists?(name) - select_value("SELECT COUNT(*) FROM pg_namespace WHERE nspname = #{quote(name)}", "SCHEMA").to_i > 0 + query_value("SELECT COUNT(*) FROM pg_namespace WHERE nspname = #{quote(name)}", "SCHEMA").to_i > 0 end # Verifies existence of an index with a given name. @@ -73,7 +73,7 @@ module ActiveRecord table = quoted_scope(table_name) index = quoted_scope(index_name) - select_value(<<-SQL, "SCHEMA").to_i > 0 + query_value(<<-SQL, "SCHEMA").to_i > 0 SELECT COUNT(*) FROM pg_class t INNER JOIN pg_index d ON t.oid = d.indrelid @@ -163,7 +163,7 @@ module ActiveRecord def table_comment(table_name) # :nodoc: scope = quoted_scope(table_name, type: "BASE TABLE") if scope[:name] - select_value(<<-SQL.strip_heredoc, "SCHEMA") + query_value(<<-SQL.strip_heredoc, "SCHEMA") SELECT pg_catalog.obj_description(c.oid, 'pg_class') FROM pg_catalog.pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace @@ -176,32 +176,32 @@ module ActiveRecord # Returns the current database name. def current_database - select_value("SELECT current_database()", "SCHEMA") + query_value("SELECT current_database()", "SCHEMA") end # Returns the current schema name. def current_schema - select_value("SELECT current_schema", "SCHEMA") + query_value("SELECT current_schema", "SCHEMA") end # Returns the current database encoding format. def encoding - select_value("SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = current_database()", "SCHEMA") + query_value("SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = current_database()", "SCHEMA") end # Returns the current database collation. def collation - select_value("SELECT datcollate FROM pg_database WHERE datname = current_database()", "SCHEMA") + query_value("SELECT datcollate FROM pg_database WHERE datname = current_database()", "SCHEMA") end # Returns the current database ctype. def ctype - select_value("SELECT datctype FROM pg_database WHERE datname = current_database()", "SCHEMA") + query_value("SELECT datctype FROM pg_database WHERE datname = current_database()", "SCHEMA") end # Returns an array of schema names. def schema_names - select_values(<<-SQL, "SCHEMA") + query_values(<<-SQL, "SCHEMA") SELECT nspname FROM pg_namespace WHERE nspname !~ '^pg_.*' @@ -234,12 +234,12 @@ module ActiveRecord # Returns the active schema search path. def schema_search_path - @schema_search_path ||= select_value("SHOW search_path", "SCHEMA") + @schema_search_path ||= query_value("SHOW search_path", "SCHEMA") end # Returns the current client message level. def client_min_messages - select_value("SHOW client_min_messages", "SCHEMA") + query_value("SHOW client_min_messages", "SCHEMA") end # Set the client message level. @@ -257,7 +257,7 @@ module ActiveRecord end def serial_sequence(table, column) - select_value("SELECT pg_get_serial_sequence(#{quote(table)}, #{quote(column)})", "SCHEMA") + query_value("SELECT pg_get_serial_sequence(#{quote(table)}, #{quote(column)})", "SCHEMA") end # Sets the sequence of a table's primary key to the specified value. @@ -268,7 +268,7 @@ module ActiveRecord if sequence quoted_sequence = quote_table_name(sequence) - select_value("SELECT setval(#{quote(quoted_sequence)}, #{value})", "SCHEMA") + query_value("SELECT setval(#{quote(quoted_sequence)}, #{value})", "SCHEMA") else @logger.warn "#{table} has primary key #{pk} with no default sequence." if @logger end @@ -290,18 +290,16 @@ module ActiveRecord if pk && sequence quoted_sequence = quote_table_name(sequence) - max_pk = select_value("select MAX(#{quote_column_name pk}) from #{quote_table_name(table)}") + max_pk = query_value("SELECT MAX(#{quote_column_name pk}) FROM #{quote_table_name(table)}", "SCHEMA") if max_pk.nil? if postgresql_version >= 100000 - minvalue = select_value("SELECT seqmin from pg_sequence where seqrelid = #{quote(quoted_sequence)}::regclass") + minvalue = query_value("SELECT seqmin FROM pg_sequence WHERE seqrelid = #{quote(quoted_sequence)}::regclass", "SCHEMA") else - minvalue = select_value("SELECT min_value FROM #{quoted_sequence}") + minvalue = query_value("SELECT min_value FROM #{quoted_sequence}", "SCHEMA") end end - select_value(<<-end_sql, "SCHEMA") - SELECT setval(#{quote(quoted_sequence)}, #{max_pk ? max_pk : minvalue}, #{max_pk ? true : false}) - end_sql + query_value("SELECT setval(#{quote(quoted_sequence)}, #{max_pk ? max_pk : minvalue}, #{max_pk ? true : false})", "SCHEMA") end end @@ -360,7 +358,7 @@ module ActiveRecord end def primary_keys(table_name) # :nodoc: - select_values(<<-SQL.strip_heredoc, "SCHEMA") + query_values(<<-SQL.strip_heredoc, "SCHEMA") SELECT a.attname FROM ( SELECT indrelid, indkey, generate_subscripts(indkey, 1) idx @@ -511,7 +509,7 @@ module ActiveRecord def foreign_keys(table_name) scope = quoted_scope(table_name) - fk_info = select_all(<<-SQL.strip_heredoc, "SCHEMA") + fk_info = exec_query(<<-SQL.strip_heredoc, "SCHEMA") SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete FROM pg_constraint c JOIN pg_class t1 ON c.conrelid = t1.oid diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 99edbe486f..e63563afc4 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -312,14 +312,14 @@ module ActiveRecord unless lock_id.is_a?(Integer) && lock_id.bit_length <= 63 raise(ArgumentError, "Postgres requires advisory lock ids to be a signed 64 bit integer") end - select_value("SELECT pg_try_advisory_lock(#{lock_id});") + query_value("SELECT pg_try_advisory_lock(#{lock_id})") end def release_advisory_lock(lock_id) # :nodoc: unless lock_id.is_a?(Integer) && lock_id.bit_length <= 63 raise(ArgumentError, "Postgres requires advisory lock ids to be a signed 64 bit integer") end - select_value("SELECT pg_advisory_unlock(#{lock_id})") + query_value("SELECT pg_advisory_unlock(#{lock_id})") end def enable_extension(name) @@ -336,15 +336,14 @@ module ActiveRecord def extension_enabled?(name) if supports_extensions? - res = exec_query "SELECT EXISTS(SELECT * FROM pg_available_extensions WHERE name = '#{name}' AND installed_version IS NOT NULL) as enabled", - "SCHEMA" + res = exec_query("SELECT EXISTS(SELECT * FROM pg_available_extensions WHERE name = '#{name}' AND installed_version IS NOT NULL) as enabled", "SCHEMA") res.cast_values.first end end def extensions if supports_extensions? - exec_query("SELECT extname from pg_extension", "SCHEMA").cast_values + exec_query("SELECT extname FROM pg_extension", "SCHEMA").cast_values else super end @@ -352,14 +351,14 @@ module ActiveRecord # Returns the configured supported identifier length supported by PostgreSQL def table_alias_length - @max_identifier_length ||= select_value("SHOW max_identifier_length", "SCHEMA").to_i + @max_identifier_length ||= query_value("SHOW max_identifier_length", "SCHEMA").to_i end alias index_name_length table_alias_length # Set the authorized user for this session def session_auth=(user) clear_cache! - exec_query "SET SESSION AUTHORIZATION #{user}" + execute("SET SESSION AUTHORIZATION #{user}") end def use_insert_returning? diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb index e02491edb6..00ff804e80 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb @@ -11,7 +11,7 @@ module ActiveRecord end exec_query("PRAGMA index_list(#{quote_table_name(table_name)})", "SCHEMA").map do |row| - index_sql = select_value(<<-SQL, "SCHEMA") + index_sql = query_value(<<-SQL, "SCHEMA") SELECT sql FROM sqlite_master WHERE name = #{quote(row['name'])} AND type = 'index' diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index ee2faf43b5..17c63d4b5f 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -169,7 +169,7 @@ module ActiveRecord # REFERENTIAL INTEGRITY ==================================== def disable_referential_integrity # :nodoc: - old = select_value("PRAGMA foreign_keys") + old = query_value("PRAGMA foreign_keys") begin execute("PRAGMA foreign_keys = OFF") @@ -337,7 +337,7 @@ module ActiveRecord alias :add_belongs_to :add_reference def foreign_keys(table_name) - fk_info = select_all("PRAGMA foreign_key_list(#{quote(table_name)})", "SCHEMA") + fk_info = exec_query("PRAGMA foreign_key_list(#{quote(table_name)})", "SCHEMA") fk_info.map do |row| options = { column: row["from"], @@ -443,7 +443,7 @@ module ActiveRecord end def sqlite_version - @sqlite_version ||= SQLite3Adapter::Version.new(select_value("SELECT sqlite_version(*)")) + @sqlite_version ||= SQLite3Adapter::Version.new(query_value("SELECT sqlite_version(*)")) end def translate_exception(exception, message) -- cgit v1.2.3 From 89d56699bd6883eac76df60fe0dce7181228349f Mon Sep 17 00:00:00 2001 From: fatkodima Date: Sat, 1 Jul 2017 00:50:12 +0300 Subject: Delete stale comment for `AR::Associations::Builder::CollectionAssociation` --- .../lib/active_record/associations/builder/collection_association.rb | 2 -- 1 file changed, 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/builder/collection_association.rb b/activerecord/lib/active_record/associations/builder/collection_association.rb index edeb6491bd..1fb8f76f2e 100644 --- a/activerecord/lib/active_record/associations/builder/collection_association.rb +++ b/activerecord/lib/active_record/associations/builder/collection_association.rb @@ -1,5 +1,3 @@ -# This class is inherited by the has_many and has_many_and_belongs_to_many association classes - require "active_record/associations" module ActiveRecord::Associations::Builder # :nodoc: -- cgit v1.2.3 From cfade1ec7ee7b5b51f3c1578e3474f9c156f2971 Mon Sep 17 00:00:00 2001 From: Kir Shatrov Date: Thu, 22 Jun 2017 22:59:18 -0400 Subject: Enforce frozen string in Rubocop --- activerecord/Rakefile | 1 + activerecord/activerecord.gemspec | 1 + activerecord/bin/test | 1 + activerecord/examples/performance.rb | 1 + activerecord/examples/simple.rb | 1 + activerecord/lib/active_record.rb | 1 + activerecord/lib/active_record/aggregations.rb | 1 + activerecord/lib/active_record/association_relation.rb | 1 + activerecord/lib/active_record/associations.rb | 1 + .../lib/active_record/associations/alias_tracker.rb | 1 + .../lib/active_record/associations/association.rb | 1 + .../lib/active_record/associations/association_scope.rb | 1 + .../active_record/associations/belongs_to_association.rb | 1 + .../associations/belongs_to_polymorphic_association.rb | 1 + .../lib/active_record/associations/builder/association.rb | 1 + .../lib/active_record/associations/builder/belongs_to.rb | 1 + .../associations/builder/collection_association.rb | 1 + .../associations/builder/has_and_belongs_to_many.rb | 1 + .../lib/active_record/associations/builder/has_many.rb | 1 + .../lib/active_record/associations/builder/has_one.rb | 1 + .../associations/builder/singular_association.rb | 1 + .../active_record/associations/collection_association.rb | 1 + .../lib/active_record/associations/collection_proxy.rb | 1 + .../lib/active_record/associations/foreign_association.rb | 1 + .../active_record/associations/has_many_association.rb | 1 + .../associations/has_many_through_association.rb | 1 + .../lib/active_record/associations/has_one_association.rb | 1 + .../associations/has_one_through_association.rb | 1 + .../lib/active_record/associations/join_dependency.rb | 1 + .../associations/join_dependency/join_association.rb | 1 + .../associations/join_dependency/join_base.rb | 1 + .../associations/join_dependency/join_part.rb | 1 + activerecord/lib/active_record/associations/preloader.rb | 1 + .../active_record/associations/preloader/association.rb | 1 + .../active_record/associations/preloader/belongs_to.rb | 1 + .../associations/preloader/collection_association.rb | 1 + .../lib/active_record/associations/preloader/has_many.rb | 1 + .../associations/preloader/has_many_through.rb | 1 + .../lib/active_record/associations/preloader/has_one.rb | 1 + .../associations/preloader/has_one_through.rb | 1 + .../associations/preloader/singular_association.rb | 1 + .../associations/preloader/through_association.rb | 1 + .../active_record/associations/singular_association.rb | 1 + .../lib/active_record/associations/through_association.rb | 1 + activerecord/lib/active_record/attribute.rb | 1 + .../lib/active_record/attribute/user_provided_default.rb | 1 + activerecord/lib/active_record/attribute_assignment.rb | 1 + activerecord/lib/active_record/attribute_decorators.rb | 1 + activerecord/lib/active_record/attribute_methods.rb | 1 + .../active_record/attribute_methods/before_type_cast.rb | 1 + .../lib/active_record/attribute_methods/primary_key.rb | 1 + activerecord/lib/active_record/attribute_methods/query.rb | 1 + activerecord/lib/active_record/attribute_methods/read.rb | 1 + .../lib/active_record/attribute_methods/serialization.rb | 1 + .../attribute_methods/time_zone_conversion.rb | 1 + activerecord/lib/active_record/attribute_methods/write.rb | 1 + .../lib/active_record/attribute_mutation_tracker.rb | 1 + activerecord/lib/active_record/attribute_set.rb | 1 + activerecord/lib/active_record/attribute_set/builder.rb | 1 + .../lib/active_record/attribute_set/yaml_encoder.rb | 1 + activerecord/lib/active_record/attributes.rb | 1 + activerecord/lib/active_record/autosave_association.rb | 1 + activerecord/lib/active_record/base.rb | 1 + activerecord/lib/active_record/callbacks.rb | 1 + activerecord/lib/active_record/coders/json.rb | 1 + activerecord/lib/active_record/coders/yaml_column.rb | 1 + activerecord/lib/active_record/collection_cache_key.rb | 1 + .../connection_adapters/abstract/connection_pool.rb | 1 + .../connection_adapters/abstract/database_limits.rb | 1 + .../connection_adapters/abstract/database_statements.rb | 1 + .../connection_adapters/abstract/query_cache.rb | 1 + .../active_record/connection_adapters/abstract/quoting.rb | 1 + .../connection_adapters/abstract/savepoints.rb | 1 + .../connection_adapters/abstract/schema_creation.rb | 1 + .../connection_adapters/abstract/schema_definitions.rb | 1 + .../connection_adapters/abstract/schema_dumper.rb | 1 + .../connection_adapters/abstract/schema_statements.rb | 1 + .../connection_adapters/abstract/transaction.rb | 1 + .../active_record/connection_adapters/abstract_adapter.rb | 1 + .../connection_adapters/abstract_mysql_adapter.rb | 1 + .../lib/active_record/connection_adapters/column.rb | 1 + .../connection_adapters/connection_specification.rb | 1 + .../determine_if_preparable_visitor.rb | 1 + .../lib/active_record/connection_adapters/mysql/column.rb | 1 + .../connection_adapters/mysql/database_statements.rb | 1 + .../connection_adapters/mysql/explain_pretty_printer.rb | 1 + .../active_record/connection_adapters/mysql/quoting.rb | 1 + .../connection_adapters/mysql/schema_creation.rb | 1 + .../connection_adapters/mysql/schema_definitions.rb | 1 + .../connection_adapters/mysql/schema_dumper.rb | 1 + .../connection_adapters/mysql/schema_statements.rb | 1 + .../connection_adapters/mysql/type_metadata.rb | 1 + .../active_record/connection_adapters/mysql2_adapter.rb | 1 + .../connection_adapters/postgresql/column.rb | 1 + .../connection_adapters/postgresql/database_statements.rb | 1 + .../postgresql/explain_pretty_printer.rb | 1 + .../active_record/connection_adapters/postgresql/oid.rb | 1 + .../connection_adapters/postgresql/oid/array.rb | 1 + .../connection_adapters/postgresql/oid/bit.rb | 1 + .../connection_adapters/postgresql/oid/bit_varying.rb | 1 + .../connection_adapters/postgresql/oid/bytea.rb | 1 + .../connection_adapters/postgresql/oid/cidr.rb | 1 + .../connection_adapters/postgresql/oid/date_time.rb | 1 + .../connection_adapters/postgresql/oid/decimal.rb | 1 + .../connection_adapters/postgresql/oid/enum.rb | 1 + .../connection_adapters/postgresql/oid/hstore.rb | 1 + .../connection_adapters/postgresql/oid/inet.rb | 1 + .../connection_adapters/postgresql/oid/json.rb | 1 + .../connection_adapters/postgresql/oid/jsonb.rb | 1 + .../connection_adapters/postgresql/oid/legacy_point.rb | 1 + .../connection_adapters/postgresql/oid/money.rb | 1 + .../connection_adapters/postgresql/oid/oid.rb | 1 + .../connection_adapters/postgresql/oid/point.rb | 1 + .../connection_adapters/postgresql/oid/range.rb | 1 + .../postgresql/oid/specialized_string.rb | 1 + .../postgresql/oid/type_map_initializer.rb | 1 + .../connection_adapters/postgresql/oid/uuid.rb | 1 + .../connection_adapters/postgresql/oid/vector.rb | 1 + .../connection_adapters/postgresql/oid/xml.rb | 1 + .../connection_adapters/postgresql/quoting.rb | 1 + .../postgresql/referential_integrity.rb | 1 + .../connection_adapters/postgresql/schema_creation.rb | 1 + .../connection_adapters/postgresql/schema_definitions.rb | 1 + .../connection_adapters/postgresql/schema_dumper.rb | 1 + .../connection_adapters/postgresql/schema_statements.rb | 1 + .../connection_adapters/postgresql/type_metadata.rb | 1 + .../active_record/connection_adapters/postgresql/utils.rb | 1 + .../connection_adapters/postgresql_adapter.rb | 1 + .../lib/active_record/connection_adapters/schema_cache.rb | 1 + .../connection_adapters/sql_type_metadata.rb | 1 + .../connection_adapters/sqlite3/explain_pretty_printer.rb | 1 + .../active_record/connection_adapters/sqlite3/quoting.rb | 1 + .../connection_adapters/sqlite3/schema_creation.rb | 1 + .../connection_adapters/sqlite3/schema_definitions.rb | 1 + .../connection_adapters/sqlite3/schema_dumper.rb | 1 + .../connection_adapters/sqlite3/schema_statements.rb | 1 + .../active_record/connection_adapters/sqlite3_adapter.rb | 1 + .../active_record/connection_adapters/statement_pool.rb | 1 + activerecord/lib/active_record/connection_handling.rb | 1 + activerecord/lib/active_record/core.rb | 1 + activerecord/lib/active_record/counter_cache.rb | 1 + activerecord/lib/active_record/define_callbacks.rb | 1 + activerecord/lib/active_record/dynamic_matchers.rb | 1 + activerecord/lib/active_record/enum.rb | 1 + activerecord/lib/active_record/errors.rb | 1 + activerecord/lib/active_record/explain.rb | 1 + activerecord/lib/active_record/explain_registry.rb | 1 + activerecord/lib/active_record/explain_subscriber.rb | 1 + activerecord/lib/active_record/fixture_set/file.rb | 1 + activerecord/lib/active_record/fixtures.rb | 1 + activerecord/lib/active_record/gem_version.rb | 1 + activerecord/lib/active_record/inheritance.rb | 1 + activerecord/lib/active_record/integration.rb | 1 + activerecord/lib/active_record/internal_metadata.rb | 1 + activerecord/lib/active_record/legacy_yaml_adapter.rb | 1 + activerecord/lib/active_record/locking/optimistic.rb | 1 + activerecord/lib/active_record/locking/pessimistic.rb | 1 + activerecord/lib/active_record/log_subscriber.rb | 1 + activerecord/lib/active_record/migration.rb | 1 + .../lib/active_record/migration/command_recorder.rb | 1 + activerecord/lib/active_record/migration/compatibility.rb | 1 + activerecord/lib/active_record/migration/join_table.rb | 1 + activerecord/lib/active_record/model_schema.rb | 1 + activerecord/lib/active_record/nested_attributes.rb | 1 + activerecord/lib/active_record/no_touching.rb | 1 + activerecord/lib/active_record/null_relation.rb | 1 + activerecord/lib/active_record/persistence.rb | 1 + activerecord/lib/active_record/query_cache.rb | 1 + activerecord/lib/active_record/querying.rb | 1 + activerecord/lib/active_record/railtie.rb | 1 + .../lib/active_record/railties/console_sandbox.rb | 1 + .../lib/active_record/railties/controller_runtime.rb | 1 + activerecord/lib/active_record/railties/databases.rake | 1 + .../lib/active_record/railties/jdbcmysql_error.rb | 1 + activerecord/lib/active_record/readonly_attributes.rb | 1 + activerecord/lib/active_record/reflection.rb | 1 + activerecord/lib/active_record/relation.rb | 1 + activerecord/lib/active_record/relation/batches.rb | 1 + .../active_record/relation/batches/batch_enumerator.rb | 1 + activerecord/lib/active_record/relation/calculations.rb | 1 + activerecord/lib/active_record/relation/delegation.rb | 1 + activerecord/lib/active_record/relation/finder_methods.rb | 1 + activerecord/lib/active_record/relation/from_clause.rb | 1 + activerecord/lib/active_record/relation/merger.rb | 1 + .../lib/active_record/relation/predicate_builder.rb | 1 + .../relation/predicate_builder/array_handler.rb | 1 + .../relation/predicate_builder/association_query_value.rb | 1 + .../relation/predicate_builder/base_handler.rb | 1 + .../relation/predicate_builder/basic_object_handler.rb | 1 + .../relation/predicate_builder/polymorphic_array_value.rb | 1 + .../relation/predicate_builder/range_handler.rb | 1 + .../relation/predicate_builder/relation_handler.rb | 1 + .../lib/active_record/relation/query_attribute.rb | 1 + activerecord/lib/active_record/relation/query_methods.rb | 1 + .../lib/active_record/relation/record_fetch_warning.rb | 1 + activerecord/lib/active_record/relation/spawn_methods.rb | 1 + activerecord/lib/active_record/relation/where_clause.rb | 1 + .../lib/active_record/relation/where_clause_factory.rb | 1 + activerecord/lib/active_record/result.rb | 1 + activerecord/lib/active_record/runtime_registry.rb | 1 + activerecord/lib/active_record/sanitization.rb | 1 + activerecord/lib/active_record/schema.rb | 1 + activerecord/lib/active_record/schema_dumper.rb | 1 + activerecord/lib/active_record/schema_migration.rb | 1 + activerecord/lib/active_record/scoping.rb | 1 + activerecord/lib/active_record/scoping/default.rb | 1 + activerecord/lib/active_record/scoping/named.rb | 1 + activerecord/lib/active_record/secure_token.rb | 1 + activerecord/lib/active_record/serialization.rb | 1 + activerecord/lib/active_record/statement_cache.rb | 1 + activerecord/lib/active_record/store.rb | 1 + activerecord/lib/active_record/suppressor.rb | 1 + activerecord/lib/active_record/table_metadata.rb | 1 + activerecord/lib/active_record/tasks/database_tasks.rb | 1 + .../lib/active_record/tasks/mysql_database_tasks.rb | 1 + .../lib/active_record/tasks/postgresql_database_tasks.rb | 1 + .../lib/active_record/tasks/sqlite_database_tasks.rb | 1 + activerecord/lib/active_record/touch_later.rb | 1 + activerecord/lib/active_record/transactions.rb | 1 + activerecord/lib/active_record/translation.rb | 1 + activerecord/lib/active_record/type.rb | 1 + .../lib/active_record/type/adapter_specific_registry.rb | 1 + activerecord/lib/active_record/type/date.rb | 1 + activerecord/lib/active_record/type/date_time.rb | 1 + .../lib/active_record/type/decimal_without_scale.rb | 1 + .../lib/active_record/type/hash_lookup_type_map.rb | 1 + activerecord/lib/active_record/type/internal/timezone.rb | 1 + activerecord/lib/active_record/type/json.rb | 1 + activerecord/lib/active_record/type/serialized.rb | 1 + activerecord/lib/active_record/type/text.rb | 1 + activerecord/lib/active_record/type/time.rb | 1 + activerecord/lib/active_record/type/type_map.rb | 1 + activerecord/lib/active_record/type/unsigned_integer.rb | 1 + activerecord/lib/active_record/type_caster.rb | 1 + activerecord/lib/active_record/type_caster/connection.rb | 1 + activerecord/lib/active_record/type_caster/map.rb | 1 + activerecord/lib/active_record/validations.rb | 1 + activerecord/lib/active_record/validations/absence.rb | 1 + activerecord/lib/active_record/validations/associated.rb | 1 + activerecord/lib/active_record/validations/length.rb | 1 + activerecord/lib/active_record/validations/presence.rb | 1 + activerecord/lib/active_record/validations/uniqueness.rb | 1 + activerecord/lib/active_record/version.rb | 1 + activerecord/lib/rails/generators/active_record.rb | 1 + .../lib/rails/generators/active_record/migration.rb | 1 + .../active_record/migration/migration_generator.rb | 1 + .../generators/active_record/model/model_generator.rb | 1 + .../active_record/connection_adapters/fake_adapter.rb | 1 + activerecord/test/cases/adapter_test.rb | 1 + .../test/cases/adapters/mysql2/active_schema_test.rb | 1 + .../test/cases/adapters/mysql2/bind_parameter_test.rb | 1 + activerecord/test/cases/adapters/mysql2/boolean_test.rb | 1 + .../test/cases/adapters/mysql2/case_sensitivity_test.rb | 1 + .../test/cases/adapters/mysql2/charset_collation_test.rb | 1 + .../test/cases/adapters/mysql2/connection_test.rb | 1 + .../adapters/mysql2/datetime_precision_quoting_test.rb | 1 + activerecord/test/cases/adapters/mysql2/enum_test.rb | 1 + activerecord/test/cases/adapters/mysql2/explain_test.rb | 1 + activerecord/test/cases/adapters/mysql2/json_test.rb | 1 + .../test/cases/adapters/mysql2/mysql2_adapter_test.rb | 1 + .../test/cases/adapters/mysql2/schema_migrations_test.rb | 1 + activerecord/test/cases/adapters/mysql2/schema_test.rb | 1 + activerecord/test/cases/adapters/mysql2/sp_test.rb | 1 + activerecord/test/cases/adapters/mysql2/sql_types_test.rb | 1 + .../test/cases/adapters/mysql2/table_options_test.rb | 1 + .../test/cases/adapters/mysql2/transaction_test.rb | 1 + .../test/cases/adapters/mysql2/unsigned_type_test.rb | 1 + .../test/cases/adapters/mysql2/virtual_column_test.rb | 1 + .../test/cases/adapters/postgresql/active_schema_test.rb | 1 + activerecord/test/cases/adapters/postgresql/array_test.rb | 1 + .../test/cases/adapters/postgresql/bit_string_test.rb | 1 + activerecord/test/cases/adapters/postgresql/bytea_test.rb | 1 + .../cases/adapters/postgresql/case_insensitive_test.rb | 1 + .../test/cases/adapters/postgresql/change_schema_test.rb | 1 + activerecord/test/cases/adapters/postgresql/cidr_test.rb | 1 + .../test/cases/adapters/postgresql/citext_test.rb | 1 + .../test/cases/adapters/postgresql/collation_test.rb | 1 + .../test/cases/adapters/postgresql/composite_test.rb | 1 + .../test/cases/adapters/postgresql/connection_test.rb | 1 + .../test/cases/adapters/postgresql/datatype_test.rb | 1 + .../test/cases/adapters/postgresql/domain_test.rb | 1 + activerecord/test/cases/adapters/postgresql/enum_test.rb | 1 + .../test/cases/adapters/postgresql/explain_test.rb | 1 + .../cases/adapters/postgresql/extension_migration_test.rb | 1 + .../test/cases/adapters/postgresql/full_text_test.rb | 1 + .../test/cases/adapters/postgresql/geometric_test.rb | 1 + .../test/cases/adapters/postgresql/hstore_test.rb | 1 + .../test/cases/adapters/postgresql/infinity_test.rb | 1 + .../test/cases/adapters/postgresql/integer_test.rb | 1 + activerecord/test/cases/adapters/postgresql/json_test.rb | 1 + activerecord/test/cases/adapters/postgresql/ltree_test.rb | 1 + activerecord/test/cases/adapters/postgresql/money_test.rb | 1 + .../test/cases/adapters/postgresql/network_test.rb | 1 + .../test/cases/adapters/postgresql/numbers_test.rb | 1 + .../cases/adapters/postgresql/postgresql_adapter_test.rb | 1 + .../postgresql/prepared_statements_disabled_test.rb | 1 + .../test/cases/adapters/postgresql/quoting_test.rb | 1 + activerecord/test/cases/adapters/postgresql/range_test.rb | 1 + .../adapters/postgresql/referential_integrity_test.rb | 1 + .../test/cases/adapters/postgresql/rename_table_test.rb | 1 + .../adapters/postgresql/schema_authorization_test.rb | 1 + .../test/cases/adapters/postgresql/schema_test.rb | 1 + .../test/cases/adapters/postgresql/serial_test.rb | 1 + .../test/cases/adapters/postgresql/statement_pool_test.rb | 1 + .../test/cases/adapters/postgresql/timestamp_test.rb | 1 + .../test/cases/adapters/postgresql/transaction_test.rb | 1 + .../test/cases/adapters/postgresql/type_lookup_test.rb | 1 + activerecord/test/cases/adapters/postgresql/utils_test.rb | 1 + activerecord/test/cases/adapters/postgresql/uuid_test.rb | 1 + activerecord/test/cases/adapters/postgresql/xml_test.rb | 1 + .../test/cases/adapters/sqlite3/collation_test.rb | 1 + .../test/cases/adapters/sqlite3/copy_table_test.rb | 1 + activerecord/test/cases/adapters/sqlite3/explain_test.rb | 1 + activerecord/test/cases/adapters/sqlite3/quoting_test.rb | 1 + .../test/cases/adapters/sqlite3/sqlite3_adapter_test.rb | 1 + .../cases/adapters/sqlite3/sqlite3_create_folder_test.rb | 1 + .../test/cases/adapters/sqlite3/statement_pool_test.rb | 1 + activerecord/test/cases/aggregations_test.rb | 1 + activerecord/test/cases/ar_schema_test.rb | 1 + .../test/cases/associations/association_scope_test.rb | 1 + .../cases/associations/belongs_to_associations_test.rb | 1 + .../bidirectional_destroy_dependencies_test.rb | 1 + activerecord/test/cases/associations/callbacks_test.rb | 1 + .../cases/associations/cascaded_eager_loading_test.rb | 1 + .../eager_load_includes_full_sti_class_test.rb | 1 + .../cases/associations/eager_load_nested_include_test.rb | 1 + .../test/cases/associations/eager_singularization_test.rb | 1 + activerecord/test/cases/associations/eager_test.rb | 1 + activerecord/test/cases/associations/extension_test.rb | 1 + .../has_and_belongs_to_many_associations_test.rb | 1 + .../test/cases/associations/has_many_associations_test.rb | 1 + .../associations/has_many_through_associations_test.rb | 1 + .../test/cases/associations/has_one_associations_test.rb | 1 + .../associations/has_one_through_associations_test.rb | 1 + .../cases/associations/inner_join_association_test.rb | 1 + .../test/cases/associations/inverse_associations_test.rb | 1 + activerecord/test/cases/associations/join_model_test.rb | 1 + .../associations/left_outer_join_association_test.rb | 1 + .../associations/nested_through_associations_test.rb | 1 + activerecord/test/cases/associations/required_test.rb | 1 + activerecord/test/cases/associations_test.rb | 1 + activerecord/test/cases/attribute_decorators_test.rb | 1 + activerecord/test/cases/attribute_methods/read_test.rb | 1 + activerecord/test/cases/attribute_methods_test.rb | 1 + activerecord/test/cases/attribute_set_test.rb | 1 + activerecord/test/cases/attribute_test.rb | 1 + activerecord/test/cases/attributes_test.rb | 1 + activerecord/test/cases/autosave_association_test.rb | 1 + activerecord/test/cases/base_test.rb | 1 + activerecord/test/cases/batches_test.rb | 1 + activerecord/test/cases/binary_test.rb | 1 + activerecord/test/cases/bind_parameter_test.rb | 1 + activerecord/test/cases/cache_key_test.rb | 1 + activerecord/test/cases/calculations_test.rb | 1 + activerecord/test/cases/callbacks_test.rb | 1 + activerecord/test/cases/clone_test.rb | 1 + activerecord/test/cases/coders/json_test.rb | 1 + activerecord/test/cases/coders/yaml_column_test.rb | 1 + activerecord/test/cases/collection_cache_key_test.rb | 1 + activerecord/test/cases/column_alias_test.rb | 1 + activerecord/test/cases/column_definition_test.rb | 1 + activerecord/test/cases/comment_test.rb | 1 + .../cases/connection_adapters/adapter_leasing_test.rb | 1 + .../cases/connection_adapters/connection_handler_test.rb | 1 + .../connection_adapters/connection_specification_test.rb | 1 + .../merge_and_resolve_default_url_config_test.rb | 1 + .../cases/connection_adapters/mysql_type_lookup_test.rb | 1 + .../test/cases/connection_adapters/schema_cache_test.rb | 1 + .../test/cases/connection_adapters/type_lookup_test.rb | 1 + activerecord/test/cases/connection_management_test.rb | 1 + activerecord/test/cases/connection_pool_test.rb | 1 + .../test/cases/connection_specification/resolver_test.rb | 1 + activerecord/test/cases/core_test.rb | 1 + activerecord/test/cases/counter_cache_test.rb | 1 + activerecord/test/cases/custom_locking_test.rb | 1 + activerecord/test/cases/database_statements_test.rb | 1 + activerecord/test/cases/date_test.rb | 1 + activerecord/test/cases/date_time_precision_test.rb | 1 + activerecord/test/cases/date_time_test.rb | 1 + activerecord/test/cases/defaults_test.rb | 1 + activerecord/test/cases/dirty_test.rb | 1 + activerecord/test/cases/disconnected_test.rb | 1 + activerecord/test/cases/dup_test.rb | 1 + activerecord/test/cases/enum_test.rb | 1 + activerecord/test/cases/errors_test.rb | 1 + activerecord/test/cases/explain_subscriber_test.rb | 1 + activerecord/test/cases/explain_test.rb | 1 + activerecord/test/cases/finder_respond_to_test.rb | 1 + activerecord/test/cases/finder_test.rb | 1 + activerecord/test/cases/fixture_set/file_test.rb | 1 + activerecord/test/cases/fixtures_test.rb | 1 + .../test/cases/forbidden_attributes_protection_test.rb | 1 + activerecord/test/cases/habtm_destroy_order_test.rb | 1 + activerecord/test/cases/helper.rb | 1 + activerecord/test/cases/hot_compatibility_test.rb | 1 + activerecord/test/cases/i18n_test.rb | 1 + activerecord/test/cases/inheritance_test.rb | 1 + activerecord/test/cases/integration_test.rb | 1 + activerecord/test/cases/invalid_connection_test.rb | 1 + activerecord/test/cases/invertible_migration_test.rb | 1 + activerecord/test/cases/json_attribute_test.rb | 1 + activerecord/test/cases/json_serialization_test.rb | 1 + activerecord/test/cases/json_shared_test_cases.rb | 1 + activerecord/test/cases/locking_test.rb | 1 + activerecord/test/cases/log_subscriber_test.rb | 1 + activerecord/test/cases/migration/change_schema_test.rb | 1 + activerecord/test/cases/migration/change_table_test.rb | 1 + .../test/cases/migration/column_attributes_test.rb | 1 + .../test/cases/migration/column_positioning_test.rb | 1 + activerecord/test/cases/migration/columns_test.rb | 1 + .../test/cases/migration/command_recorder_test.rb | 1 + activerecord/test/cases/migration/compatibility_test.rb | 1 + .../test/cases/migration/create_join_table_test.rb | 1 + activerecord/test/cases/migration/foreign_key_test.rb | 1 + activerecord/test/cases/migration/helper.rb | 1 + activerecord/test/cases/migration/index_test.rb | 1 + activerecord/test/cases/migration/logger_test.rb | 1 + .../test/cases/migration/pending_migrations_test.rb | 1 + .../test/cases/migration/references_foreign_key_test.rb | 1 + .../test/cases/migration/references_index_test.rb | 1 + .../test/cases/migration/references_statements_test.rb | 1 + activerecord/test/cases/migration/rename_table_test.rb | 1 + activerecord/test/cases/migration_test.rb | 1 + activerecord/test/cases/migrator_test.rb | 1 + activerecord/test/cases/mixin_test.rb | 1 + activerecord/test/cases/modules_test.rb | 1 + activerecord/test/cases/multiparameter_attributes_test.rb | 1 + activerecord/test/cases/multiple_db_test.rb | 1 + activerecord/test/cases/nested_attributes_test.rb | 1 + .../test/cases/nested_attributes_with_callbacks_test.rb | 1 + activerecord/test/cases/numeric_data_test.rb | 1 + activerecord/test/cases/persistence_test.rb | 1 + activerecord/test/cases/pooled_connections_test.rb | 1 + activerecord/test/cases/primary_keys_test.rb | 1 + activerecord/test/cases/query_cache_test.rb | 1 + activerecord/test/cases/quoting_test.rb | 1 + activerecord/test/cases/readonly_test.rb | 1 + activerecord/test/cases/reaper_test.rb | 1 + activerecord/test/cases/reflection_test.rb | 1 + activerecord/test/cases/relation/delegation_test.rb | 1 + activerecord/test/cases/relation/merging_test.rb | 1 + activerecord/test/cases/relation/mutation_test.rb | 1 + activerecord/test/cases/relation/or_test.rb | 1 + .../test/cases/relation/predicate_builder_test.rb | 1 + .../test/cases/relation/record_fetch_warning_test.rb | 1 + activerecord/test/cases/relation/where_chain_test.rb | 1 + activerecord/test/cases/relation/where_clause_test.rb | 1 + activerecord/test/cases/relation/where_test.rb | 1 + activerecord/test/cases/relation_test.rb | 1 + activerecord/test/cases/relations_test.rb | 1 + activerecord/test/cases/reload_models_test.rb | 1 + activerecord/test/cases/reserved_word_test.rb | 1 + activerecord/test/cases/result_test.rb | 1 + activerecord/test/cases/sanitize_test.rb | 1 + activerecord/test/cases/schema_dumper_test.rb | 1 + activerecord/test/cases/schema_loading_test.rb | 1 + activerecord/test/cases/scoping/default_scoping_test.rb | 1 + activerecord/test/cases/scoping/named_scoping_test.rb | 1 + activerecord/test/cases/scoping/relation_scoping_test.rb | 1 + activerecord/test/cases/secure_token_test.rb | 1 + activerecord/test/cases/serialization_test.rb | 1 + activerecord/test/cases/serialized_attribute_test.rb | 1 + activerecord/test/cases/statement_cache_test.rb | 1 + activerecord/test/cases/store_test.rb | 1 + activerecord/test/cases/suppressor_test.rb | 1 + activerecord/test/cases/tasks/database_tasks_test.rb | 1 + activerecord/test/cases/tasks/mysql_rake_test.rb | 1 + activerecord/test/cases/tasks/postgresql_rake_test.rb | 1 + activerecord/test/cases/tasks/sqlite_rake_test.rb | 1 + activerecord/test/cases/test_case.rb | 1 + activerecord/test/cases/test_fixtures_test.rb | 1 + activerecord/test/cases/time_precision_test.rb | 1 + activerecord/test/cases/timestamp_test.rb | 1 + activerecord/test/cases/touch_later_test.rb | 1 + activerecord/test/cases/transaction_callbacks_test.rb | 1 + activerecord/test/cases/transaction_isolation_test.rb | 1 + activerecord/test/cases/transactions_test.rb | 1 + .../test/cases/type/adapter_specific_registry_test.rb | 1 + activerecord/test/cases/type/date_time_test.rb | 1 + activerecord/test/cases/type/integer_test.rb | 1 + activerecord/test/cases/type/string_test.rb | 1 + activerecord/test/cases/type/type_map_test.rb | 1 + activerecord/test/cases/type/unsigned_integer_test.rb | 1 + activerecord/test/cases/type_test.rb | 1 + activerecord/test/cases/types_test.rb | 1 + activerecord/test/cases/unconnected_test.rb | 1 + .../test/cases/validations/absence_validation_test.rb | 1 + .../test/cases/validations/association_validation_test.rb | 1 + .../validations/i18n_generate_message_validation_test.rb | 1 + .../test/cases/validations/i18n_validation_test.rb | 1 + .../test/cases/validations/length_validation_test.rb | 1 + .../test/cases/validations/presence_validation_test.rb | 1 + .../test/cases/validations/uniqueness_validation_test.rb | 1 + activerecord/test/cases/validations_repair_helper.rb | 1 + activerecord/test/cases/validations_test.rb | 1 + activerecord/test/cases/view_test.rb | 1 + activerecord/test/cases/yaml_serialization_test.rb | 1 + activerecord/test/config.rb | 1 + .../test/migrations/10_urban/9_add_expressions.rb | 1 + .../test/migrations/decimal/1_give_me_big_numbers.rb | 1 + .../test/migrations/magic/1_currencies_have_symbols.rb | 5 +++-- .../migrations/missing/1000_people_have_middle_names.rb | 1 + .../test/migrations/missing/1_people_have_last_names.rb | 1 + .../test/migrations/missing/3_we_need_reminders.rb | 1 + .../test/migrations/missing/4_innocent_jointable.rb | 1 + activerecord/test/migrations/rename/1_we_need_things.rb | 1 + activerecord/test/migrations/rename/2_rename_things.rb | 1 + .../test/migrations/to_copy/1_people_have_hobbies.rb | 1 + .../test/migrations/to_copy/2_people_have_descriptions.rb | 1 + .../test/migrations/to_copy2/1_create_articles.rb | 1 + .../test/migrations/to_copy2/2_create_comments.rb | 1 + .../to_copy_with_name_collision/1_people_have_hobbies.rb | 1 + .../20090101010101_people_have_hobbies.rb | 1 + .../20090101010202_people_have_descriptions.rb | 1 + .../20090101010101_create_articles.rb | 1 + .../20090101010202_create_comments.rb | 1 + .../migrations/valid/1_valid_people_have_last_names.rb | 1 + activerecord/test/migrations/valid/2_we_need_reminders.rb | 1 + .../test/migrations/valid/3_innocent_jointable.rb | 1 + .../1_valid_people_have_last_names.rb | 1 + .../valid_with_subdirectories/sub/2_we_need_reminders.rb | 1 + .../sub1/3_innocent_jointable.rb | 1 + ...010101_valid_with_timestamps_people_have_last_names.rb | 1 + ...00201010101_valid_with_timestamps_we_need_reminders.rb | 1 + ...0301010101_valid_with_timestamps_innocent_jointable.rb | 1 + .../20131219224947_migration_version_check.rb | 1 + activerecord/test/models/admin.rb | 1 + activerecord/test/models/admin/account.rb | 1 + activerecord/test/models/admin/randomly_named_c1.rb | 15 ++++++++------- activerecord/test/models/admin/user.rb | 1 + activerecord/test/models/aircraft.rb | 1 + activerecord/test/models/arunit2_model.rb | 1 + activerecord/test/models/author.rb | 1 + activerecord/test/models/auto_id.rb | 1 + activerecord/test/models/autoloadable/extra_firm.rb | 1 + activerecord/test/models/binary.rb | 1 + activerecord/test/models/bird.rb | 1 + activerecord/test/models/book.rb | 1 + activerecord/test/models/boolean.rb | 1 + activerecord/test/models/bulb.rb | 1 + activerecord/test/models/cake_designer.rb | 1 + activerecord/test/models/car.rb | 1 + activerecord/test/models/carrier.rb | 1 + activerecord/test/models/cat.rb | 1 + activerecord/test/models/categorization.rb | 1 + activerecord/test/models/category.rb | 1 + activerecord/test/models/chef.rb | 1 + activerecord/test/models/citation.rb | 1 + activerecord/test/models/club.rb | 1 + activerecord/test/models/college.rb | 1 + activerecord/test/models/column.rb | 1 + activerecord/test/models/column_name.rb | 1 + activerecord/test/models/comment.rb | 1 + activerecord/test/models/company.rb | 1 + activerecord/test/models/company_in_module.rb | 1 + activerecord/test/models/computer.rb | 1 + activerecord/test/models/contact.rb | 1 + activerecord/test/models/content.rb | 1 + activerecord/test/models/contract.rb | 1 + activerecord/test/models/country.rb | 1 + activerecord/test/models/course.rb | 1 + activerecord/test/models/customer.rb | 1 + activerecord/test/models/customer_carrier.rb | 1 + activerecord/test/models/dashboard.rb | 1 + activerecord/test/models/default.rb | 1 + activerecord/test/models/department.rb | 1 + activerecord/test/models/developer.rb | 1 + activerecord/test/models/dog.rb | 1 + activerecord/test/models/dog_lover.rb | 1 + activerecord/test/models/doubloon.rb | 1 + activerecord/test/models/drink_designer.rb | 1 + activerecord/test/models/edge.rb | 1 + activerecord/test/models/electron.rb | 1 + activerecord/test/models/engine.rb | 1 + activerecord/test/models/entrant.rb | 1 + activerecord/test/models/essay.rb | 1 + activerecord/test/models/event.rb | 1 + activerecord/test/models/eye.rb | 1 + activerecord/test/models/face.rb | 1 + activerecord/test/models/family.rb | 1 + activerecord/test/models/family_tree.rb | 1 + activerecord/test/models/friendship.rb | 1 + activerecord/test/models/guid.rb | 1 + activerecord/test/models/guitar.rb | 1 + activerecord/test/models/hotel.rb | 1 + activerecord/test/models/image.rb | 1 + activerecord/test/models/interest.rb | 1 + activerecord/test/models/invoice.rb | 1 + activerecord/test/models/item.rb | 1 + activerecord/test/models/job.rb | 1 + activerecord/test/models/joke.rb | 1 + activerecord/test/models/keyboard.rb | 1 + activerecord/test/models/legacy_thing.rb | 1 + activerecord/test/models/lesson.rb | 1 + activerecord/test/models/line_item.rb | 1 + activerecord/test/models/liquid.rb | 1 + activerecord/test/models/man.rb | 1 + activerecord/test/models/matey.rb | 1 + activerecord/test/models/member.rb | 1 + activerecord/test/models/member_detail.rb | 1 + activerecord/test/models/member_type.rb | 1 + activerecord/test/models/membership.rb | 1 + activerecord/test/models/mentor.rb | 1 + activerecord/test/models/minimalistic.rb | 1 + activerecord/test/models/minivan.rb | 1 + activerecord/test/models/mixed_case_monkey.rb | 1 + activerecord/test/models/mocktail_designer.rb | 1 + activerecord/test/models/molecule.rb | 1 + activerecord/test/models/movie.rb | 1 + activerecord/test/models/node.rb | 1 + activerecord/test/models/non_primary_key.rb | 1 + activerecord/test/models/notification.rb | 1 + activerecord/test/models/numeric_data.rb | 1 + activerecord/test/models/order.rb | 1 + activerecord/test/models/organization.rb | 1 + activerecord/test/models/other_dog.rb | 1 + activerecord/test/models/owner.rb | 1 + activerecord/test/models/parrot.rb | 1 + activerecord/test/models/person.rb | 1 + activerecord/test/models/personal_legacy_thing.rb | 1 + activerecord/test/models/pet.rb | 1 + activerecord/test/models/pet_treasure.rb | 1 + activerecord/test/models/pirate.rb | 1 + activerecord/test/models/possession.rb | 1 + activerecord/test/models/post.rb | 1 + activerecord/test/models/price_estimate.rb | 1 + activerecord/test/models/professor.rb | 1 + activerecord/test/models/project.rb | 1 + activerecord/test/models/publisher.rb | 1 + activerecord/test/models/publisher/article.rb | 1 + activerecord/test/models/publisher/magazine.rb | 1 + activerecord/test/models/randomly_named_c1.rb | 7 ++++--- activerecord/test/models/rating.rb | 1 + activerecord/test/models/reader.rb | 1 + activerecord/test/models/recipe.rb | 1 + activerecord/test/models/record.rb | 1 + activerecord/test/models/reference.rb | 1 + activerecord/test/models/reply.rb | 1 + activerecord/test/models/ship.rb | 1 + activerecord/test/models/ship_part.rb | 1 + activerecord/test/models/shop.rb | 1 + activerecord/test/models/shop_account.rb | 1 + activerecord/test/models/speedometer.rb | 1 + activerecord/test/models/sponsor.rb | 1 + activerecord/test/models/string_key_object.rb | 1 + activerecord/test/models/student.rb | 1 + activerecord/test/models/subscriber.rb | 1 + activerecord/test/models/subscription.rb | 1 + activerecord/test/models/tag.rb | 1 + activerecord/test/models/tagging.rb | 1 + activerecord/test/models/task.rb | 1 + activerecord/test/models/topic.rb | 1 + activerecord/test/models/toy.rb | 1 + activerecord/test/models/traffic_light.rb | 1 + activerecord/test/models/treasure.rb | 1 + activerecord/test/models/treaty.rb | 1 + activerecord/test/models/tree.rb | 1 + activerecord/test/models/tuning_peg.rb | 1 + activerecord/test/models/tyre.rb | 1 + activerecord/test/models/user.rb | 1 + activerecord/test/models/uuid_child.rb | 1 + activerecord/test/models/uuid_item.rb | 1 + activerecord/test/models/uuid_parent.rb | 1 + activerecord/test/models/vegetables.rb | 1 + activerecord/test/models/vehicle.rb | 1 + activerecord/test/models/vertex.rb | 1 + activerecord/test/models/warehouse_thing.rb | 1 + activerecord/test/models/wheel.rb | 1 + activerecord/test/models/without_table.rb | 1 + activerecord/test/models/zine.rb | 1 + activerecord/test/schema/mysql2_specific_schema.rb | 1 + activerecord/test/schema/oracle_specific_schema.rb | 1 + activerecord/test/schema/postgresql_specific_schema.rb | 1 + activerecord/test/schema/schema.rb | 1 + activerecord/test/support/config.rb | 1 + activerecord/test/support/connection.rb | 1 + activerecord/test/support/connection_helper.rb | 1 + activerecord/test/support/ddl_helper.rb | 1 + activerecord/test/support/schema_dumping_helper.rb | 1 + 679 files changed, 691 insertions(+), 12 deletions(-) (limited to 'activerecord') diff --git a/activerecord/Rakefile b/activerecord/Rakefile index fe5f9d1071..4347071693 100644 --- a/activerecord/Rakefile +++ b/activerecord/Rakefile @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "rake/testtask" require_relative "test/config" diff --git a/activerecord/activerecord.gemspec b/activerecord/activerecord.gemspec index a626a1f21b..b28cb0c2f7 100644 --- a/activerecord/activerecord.gemspec +++ b/activerecord/activerecord.gemspec @@ -1,3 +1,4 @@ +# frozen_string_literal: true version = File.read(File.expand_path("../RAILS_VERSION", __dir__)).strip Gem::Specification.new do |s| diff --git a/activerecord/bin/test b/activerecord/bin/test index ab69f4f603..83c192531e 100755 --- a/activerecord/bin/test +++ b/activerecord/bin/test @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true COMPONENT_ROOT = File.expand_path("..", __dir__) require_relative "../../tools/test" diff --git a/activerecord/examples/performance.rb b/activerecord/examples/performance.rb index 3257dd4ad7..74e5ffd976 100644 --- a/activerecord/examples/performance.rb +++ b/activerecord/examples/performance.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record" require "benchmark/ips" diff --git a/activerecord/examples/simple.rb b/activerecord/examples/simple.rb index c3648fee48..6b9bc781d1 100644 --- a/activerecord/examples/simple.rb +++ b/activerecord/examples/simple.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record" class Person < ActiveRecord::Base diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb index 29f49c6195..11300da52a 100644 --- a/activerecord/lib/active_record.rb +++ b/activerecord/lib/active_record.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true #-- # Copyright (c) 2004-2017 David Heinemeier Hansson # diff --git a/activerecord/lib/active_record/aggregations.rb b/activerecord/lib/active_record/aggregations.rb index 10cbd5429c..e0caad5381 100644 --- a/activerecord/lib/active_record/aggregations.rb +++ b/activerecord/lib/active_record/aggregations.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # See ActiveRecord::Aggregations::ClassMethods for documentation module Aggregations diff --git a/activerecord/lib/active_record/association_relation.rb b/activerecord/lib/active_record/association_relation.rb index de2d03cd0b..a79112cb3b 100644 --- a/activerecord/lib/active_record/association_relation.rb +++ b/activerecord/lib/active_record/association_relation.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class AssociationRelation < Relation def initialize(klass, table, predicate_builder, association) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index f05a122544..13db82b2aa 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/enumerable" require "active_support/core_ext/string/conversions" require "active_support/core_ext/module/remove_method" diff --git a/activerecord/lib/active_record/associations/alias_tracker.rb b/activerecord/lib/active_record/associations/alias_tracker.rb index 104de4f69d..eb81ba5ff6 100644 --- a/activerecord/lib/active_record/associations/alias_tracker.rb +++ b/activerecord/lib/active_record/associations/alias_tracker.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/string/conversions" module ActiveRecord diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb index 1138ae3462..0fca4467f9 100644 --- a/activerecord/lib/active_record/associations/association.rb +++ b/activerecord/lib/active_record/associations/association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/array/wrap" module ActiveRecord diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb index 6ef225b725..900ebda2bb 100644 --- a/activerecord/lib/active_record/associations/association_scope.rb +++ b/activerecord/lib/active_record/associations/association_scope.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Associations class AssociationScope #:nodoc: diff --git a/activerecord/lib/active_record/associations/belongs_to_association.rb b/activerecord/lib/active_record/associations/belongs_to_association.rb index 0e61dbfb00..b8d3173dc7 100644 --- a/activerecord/lib/active_record/associations/belongs_to_association.rb +++ b/activerecord/lib/active_record/associations/belongs_to_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record Belongs To Association module Associations diff --git a/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb b/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb index b710cf6bdb..15aae53e80 100644 --- a/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +++ b/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record Belongs To Polymorphic Association module Associations diff --git a/activerecord/lib/active_record/associations/builder/association.rb b/activerecord/lib/active_record/associations/builder/association.rb index d0534056d9..df8d77a5d1 100644 --- a/activerecord/lib/active_record/associations/builder/association.rb +++ b/activerecord/lib/active_record/associations/builder/association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # This is the parent Association class which defines the variables # used by all associations. # diff --git a/activerecord/lib/active_record/associations/builder/belongs_to.rb b/activerecord/lib/active_record/associations/builder/belongs_to.rb index 2b9dd8aae8..7c2cc61ecd 100644 --- a/activerecord/lib/active_record/associations/builder/belongs_to.rb +++ b/activerecord/lib/active_record/associations/builder/belongs_to.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord::Associations::Builder # :nodoc: class BelongsTo < SingularAssociation #:nodoc: def self.macro diff --git a/activerecord/lib/active_record/associations/builder/collection_association.rb b/activerecord/lib/active_record/associations/builder/collection_association.rb index edeb6491bd..4de3371d54 100644 --- a/activerecord/lib/active_record/associations/builder/collection_association.rb +++ b/activerecord/lib/active_record/associations/builder/collection_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # This class is inherited by the has_many and has_many_and_belongs_to_many association classes require "active_record/associations" diff --git a/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb b/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb index 6b71826431..c3e62c1a3d 100644 --- a/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb +++ b/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord::Associations::Builder # :nodoc: class HasAndBelongsToMany # :nodoc: class JoinTableResolver # :nodoc: diff --git a/activerecord/lib/active_record/associations/builder/has_many.rb b/activerecord/lib/active_record/associations/builder/has_many.rb index 7864d4c536..3e83fad619 100644 --- a/activerecord/lib/active_record/associations/builder/has_many.rb +++ b/activerecord/lib/active_record/associations/builder/has_many.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord::Associations::Builder # :nodoc: class HasMany < CollectionAssociation #:nodoc: def self.macro diff --git a/activerecord/lib/active_record/associations/builder/has_one.rb b/activerecord/lib/active_record/associations/builder/has_one.rb index 4de846d12b..66135bbc2d 100644 --- a/activerecord/lib/active_record/associations/builder/has_one.rb +++ b/activerecord/lib/active_record/associations/builder/has_one.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord::Associations::Builder # :nodoc: class HasOne < SingularAssociation #:nodoc: def self.macro diff --git a/activerecord/lib/active_record/associations/builder/singular_association.rb b/activerecord/lib/active_record/associations/builder/singular_association.rb index 7732b63af6..3a154ba25f 100644 --- a/activerecord/lib/active_record/associations/builder/singular_association.rb +++ b/activerecord/lib/active_record/associations/builder/singular_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # This class is inherited by the has_one and belongs_to association classes module ActiveRecord::Associations::Builder # :nodoc: diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index bbf3dbb75e..f73b0b90cf 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Associations # = Active Record Association Collection diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb index d77fcaf668..6ccdaebbe3 100644 --- a/activerecord/lib/active_record/associations/collection_proxy.rb +++ b/activerecord/lib/active_record/associations/collection_proxy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Associations # Association proxies in Active Record are middlemen between the object that diff --git a/activerecord/lib/active_record/associations/foreign_association.rb b/activerecord/lib/active_record/associations/foreign_association.rb index 3ceec0ee46..1fb6ff7bff 100644 --- a/activerecord/lib/active_record/associations/foreign_association.rb +++ b/activerecord/lib/active_record/associations/foreign_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord::Associations module ForeignAssociation # :nodoc: def foreign_key_present? diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 10ca0e47ff..4e0c89791e 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record Has Many Association module Associations diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb index 2fd20b4368..c4ed91aeca 100644 --- a/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record Has Many Through Association module Associations diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb index 8458253ff8..a78c1b1d32 100644 --- a/activerecord/lib/active_record/associations/has_one_association.rb +++ b/activerecord/lib/active_record/associations/has_one_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record Has One Association module Associations diff --git a/activerecord/lib/active_record/associations/has_one_through_association.rb b/activerecord/lib/active_record/associations/has_one_through_association.rb index 1183bdf6f4..1e8b2244d9 100644 --- a/activerecord/lib/active_record/associations/has_one_through_association.rb +++ b/activerecord/lib/active_record/associations/has_one_through_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record Has One Through Association module Associations diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index bc66194aef..575051c45a 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Associations class JoinDependency # :nodoc: diff --git a/activerecord/lib/active_record/associations/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/join_dependency/join_association.rb index 005410d598..5df23e92ca 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/associations/join_dependency/join_part" module ActiveRecord diff --git a/activerecord/lib/active_record/associations/join_dependency/join_base.rb b/activerecord/lib/active_record/associations/join_dependency/join_base.rb index fca20514d1..aa02c5f056 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_base.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/associations/join_dependency/join_part" module ActiveRecord diff --git a/activerecord/lib/active_record/associations/join_dependency/join_part.rb b/activerecord/lib/active_record/associations/join_dependency/join_part.rb index 80c9fde5d1..0604333f30 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_part.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_part.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Associations class JoinDependency # :nodoc: diff --git a/activerecord/lib/active_record/associations/preloader.rb b/activerecord/lib/active_record/associations/preloader.rb index 208d1b2670..130494f712 100644 --- a/activerecord/lib/active_record/associations/preloader.rb +++ b/activerecord/lib/active_record/associations/preloader.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Associations # Implements the details of eager loading of Active Record associations. diff --git a/activerecord/lib/active_record/associations/preloader/association.rb b/activerecord/lib/active_record/associations/preloader/association.rb index 63ef3f2d8c..6a8425c989 100644 --- a/activerecord/lib/active_record/associations/preloader/association.rb +++ b/activerecord/lib/active_record/associations/preloader/association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/preloader/belongs_to.rb b/activerecord/lib/active_record/associations/preloader/belongs_to.rb index c20145770f..ee7be18d15 100644 --- a/activerecord/lib/active_record/associations/preloader/belongs_to.rb +++ b/activerecord/lib/active_record/associations/preloader/belongs_to.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/preloader/collection_association.rb b/activerecord/lib/active_record/associations/preloader/collection_association.rb index 26690bf16d..59c0bc4d8e 100644 --- a/activerecord/lib/active_record/associations/preloader/collection_association.rb +++ b/activerecord/lib/active_record/associations/preloader/collection_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/preloader/has_many.rb b/activerecord/lib/active_record/associations/preloader/has_many.rb index 20df1cc19a..197f561b95 100644 --- a/activerecord/lib/active_record/associations/preloader/has_many.rb +++ b/activerecord/lib/active_record/associations/preloader/has_many.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/preloader/has_many_through.rb b/activerecord/lib/active_record/associations/preloader/has_many_through.rb index 2029871f39..3bd561c187 100644 --- a/activerecord/lib/active_record/associations/preloader/has_many_through.rb +++ b/activerecord/lib/active_record/associations/preloader/has_many_through.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/preloader/has_one.rb b/activerecord/lib/active_record/associations/preloader/has_one.rb index c4add621ca..d6254d8c56 100644 --- a/activerecord/lib/active_record/associations/preloader/has_one.rb +++ b/activerecord/lib/active_record/associations/preloader/has_one.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/preloader/has_one_through.rb b/activerecord/lib/active_record/associations/preloader/has_one_through.rb index f063f85574..512ca82005 100644 --- a/activerecord/lib/active_record/associations/preloader/has_one_through.rb +++ b/activerecord/lib/active_record/associations/preloader/has_one_through.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/preloader/singular_association.rb b/activerecord/lib/active_record/associations/preloader/singular_association.rb index 5c5828262e..5583c7d79c 100644 --- a/activerecord/lib/active_record/associations/preloader/singular_association.rb +++ b/activerecord/lib/active_record/associations/preloader/singular_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/preloader/through_association.rb b/activerecord/lib/active_record/associations/preloader/through_association.rb index 34587fd3f5..8e12afc695 100644 --- a/activerecord/lib/active_record/associations/preloader/through_association.rb +++ b/activerecord/lib/active_record/associations/preloader/through_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/singular_association.rb b/activerecord/lib/active_record/associations/singular_association.rb index f8bbe4c2ed..891caa44c3 100644 --- a/activerecord/lib/active_record/associations/singular_association.rb +++ b/activerecord/lib/active_record/associations/singular_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Associations class SingularAssociation < Association #:nodoc: diff --git a/activerecord/lib/active_record/associations/through_association.rb b/activerecord/lib/active_record/associations/through_association.rb index 6b87993ba3..fd4c1a1e78 100644 --- a/activerecord/lib/active_record/associations/through_association.rb +++ b/activerecord/lib/active_record/associations/through_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record Through Association module Associations diff --git a/activerecord/lib/active_record/attribute.rb b/activerecord/lib/active_record/attribute.rb index 38281158d8..61e8d4d849 100644 --- a/activerecord/lib/active_record/attribute.rb +++ b/activerecord/lib/active_record/attribute.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class Attribute # :nodoc: class << self diff --git a/activerecord/lib/active_record/attribute/user_provided_default.rb b/activerecord/lib/active_record/attribute/user_provided_default.rb index 57f8bbed76..b2e9ff9d99 100644 --- a/activerecord/lib/active_record/attribute/user_provided_default.rb +++ b/activerecord/lib/active_record/attribute/user_provided_default.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/attribute" module ActiveRecord diff --git a/activerecord/lib/active_record/attribute_assignment.rb b/activerecord/lib/active_record/attribute_assignment.rb index d0dfca0cac..39ba094b6d 100644 --- a/activerecord/lib/active_record/attribute_assignment.rb +++ b/activerecord/lib/active_record/attribute_assignment.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_model/forbidden_attributes_protection" module ActiveRecord diff --git a/activerecord/lib/active_record/attribute_decorators.rb b/activerecord/lib/active_record/attribute_decorators.rb index 5bc8527745..cb744d7b61 100644 --- a/activerecord/lib/active_record/attribute_decorators.rb +++ b/activerecord/lib/active_record/attribute_decorators.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module AttributeDecorators # :nodoc: extend ActiveSupport::Concern diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index 83c61fad19..b718da8555 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/enumerable" require "active_support/core_ext/string/filters" require "mutex_m" diff --git a/activerecord/lib/active_record/attribute_methods/before_type_cast.rb b/activerecord/lib/active_record/attribute_methods/before_type_cast.rb index 115eb1ef3f..7cdb85e6cf 100644 --- a/activerecord/lib/active_record/attribute_methods/before_type_cast.rb +++ b/activerecord/lib/active_record/attribute_methods/before_type_cast.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module AttributeMethods # = Active Record Attribute Methods Before Type Cast diff --git a/activerecord/lib/active_record/attribute_methods/primary_key.rb b/activerecord/lib/active_record/attribute_methods/primary_key.rb index b9b2acff37..ca21eae7c1 100644 --- a/activerecord/lib/active_record/attribute_methods/primary_key.rb +++ b/activerecord/lib/active_record/attribute_methods/primary_key.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "set" module ActiveRecord diff --git a/activerecord/lib/active_record/attribute_methods/query.rb b/activerecord/lib/active_record/attribute_methods/query.rb index 10498f4322..db86ef428e 100644 --- a/activerecord/lib/active_record/attribute_methods/query.rb +++ b/activerecord/lib/active_record/attribute_methods/query.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module AttributeMethods module Query diff --git a/activerecord/lib/active_record/attribute_methods/read.rb b/activerecord/lib/active_record/attribute_methods/read.rb index fdc4bf6621..9d85af9424 100644 --- a/activerecord/lib/active_record/attribute_methods/read.rb +++ b/activerecord/lib/active_record/attribute_methods/read.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module AttributeMethods module Read diff --git a/activerecord/lib/active_record/attribute_methods/serialization.rb b/activerecord/lib/active_record/attribute_methods/serialization.rb index 4d9aff76cc..0f267e3a34 100644 --- a/activerecord/lib/active_record/attribute_methods/serialization.rb +++ b/activerecord/lib/active_record/attribute_methods/serialization.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module AttributeMethods module Serialization 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 1f1efe8812..0c5f0a2fd1 100644 --- a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb +++ b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module AttributeMethods module TimeZoneConversion diff --git a/activerecord/lib/active_record/attribute_methods/write.rb b/activerecord/lib/active_record/attribute_methods/write.rb index 75c5a1a600..166cab7dd6 100644 --- a/activerecord/lib/active_record/attribute_methods/write.rb +++ b/activerecord/lib/active_record/attribute_methods/write.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module AttributeMethods module Write diff --git a/activerecord/lib/active_record/attribute_mutation_tracker.rb b/activerecord/lib/active_record/attribute_mutation_tracker.rb index 4de993e169..4b0d52742b 100644 --- a/activerecord/lib/active_record/attribute_mutation_tracker.rb +++ b/activerecord/lib/active_record/attribute_mutation_tracker.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class AttributeMutationTracker # :nodoc: OPTION_NOT_GIVEN = Object.new diff --git a/activerecord/lib/active_record/attribute_set.rb b/activerecord/lib/active_record/attribute_set.rb index 01f9d815d5..76de68ac70 100644 --- a/activerecord/lib/active_record/attribute_set.rb +++ b/activerecord/lib/active_record/attribute_set.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/attribute_set/builder" require "active_record/attribute_set/yaml_encoder" diff --git a/activerecord/lib/active_record/attribute_set/builder.rb b/activerecord/lib/active_record/attribute_set/builder.rb index 2f624d32af..9b75f185f7 100644 --- a/activerecord/lib/active_record/attribute_set/builder.rb +++ b/activerecord/lib/active_record/attribute_set/builder.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/attribute" module ActiveRecord diff --git a/activerecord/lib/active_record/attribute_set/yaml_encoder.rb b/activerecord/lib/active_record/attribute_set/yaml_encoder.rb index 899de14792..f3d726f53c 100644 --- a/activerecord/lib/active_record/attribute_set/yaml_encoder.rb +++ b/activerecord/lib/active_record/attribute_set/yaml_encoder.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class AttributeSet # Attempts to do more intelligent YAML dumping of an diff --git a/activerecord/lib/active_record/attributes.rb b/activerecord/lib/active_record/attributes.rb index 475b9beec4..0dceb417a5 100644 --- a/activerecord/lib/active_record/attributes.rb +++ b/activerecord/lib/active_record/attributes.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/attribute/user_provided_default" module ActiveRecord diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb index 70f0e2af8e..137e9673ab 100644 --- a/activerecord/lib/active_record/autosave_association.rb +++ b/activerecord/lib/active_record/autosave_association.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record Autosave Association # diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index ac1aa2df45..5229c82f3a 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "yaml" require "active_support/benchmarkable" require "active_support/dependencies" diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb index eb44887e18..b25a8e4033 100644 --- a/activerecord/lib/active_record/callbacks.rb +++ b/activerecord/lib/active_record/callbacks.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record \Callbacks # diff --git a/activerecord/lib/active_record/coders/json.rb b/activerecord/lib/active_record/coders/json.rb index cb185a881e..a7ad65fbf4 100644 --- a/activerecord/lib/active_record/coders/json.rb +++ b/activerecord/lib/active_record/coders/json.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Coders # :nodoc: class JSON # :nodoc: diff --git a/activerecord/lib/active_record/coders/yaml_column.rb b/activerecord/lib/active_record/coders/yaml_column.rb index 9c52a31b95..7186252b8b 100644 --- a/activerecord/lib/active_record/coders/yaml_column.rb +++ b/activerecord/lib/active_record/coders/yaml_column.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "yaml" module ActiveRecord diff --git a/activerecord/lib/active_record/collection_cache_key.rb b/activerecord/lib/active_record/collection_cache_key.rb index 8b937b6703..7831aee3a4 100644 --- a/activerecord/lib/active_record/collection_cache_key.rb +++ b/activerecord/lib/active_record/collection_cache_key.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module CollectionCacheKey def collection_cache_key(collection = all, timestamp_column = :updated_at) # :nodoc: diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index 61bf5477aa..fcdef9f033 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "thread" require "concurrent/map" require "monitor" diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb index 407e019326..6331b1546a 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters # :nodoc: module DatabaseLimits diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index af5314c1d6..d36e8d7fdd 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters # :nodoc: module DatabaseStatements diff --git a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb index c352ddfc11..31d8f53a10 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters # :nodoc: module QueryCache diff --git a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb index 61233dcc51..631e5176bb 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/big_decimal/conversions" require "active_support/multibyte/chars" diff --git a/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb b/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb index 3a06f75292..b1b793828d 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module Savepoints diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb index 93f4529202..19f0d7558e 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/string/strip" module ActiveRecord diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index a30fbe0e05..6dbf669993 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters #:nodoc: # Abstract representation of an index definition on a table. Instances of diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb index 34036d8a1d..ef8038b5c3 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters # :nodoc: # The goal of this module is to move Adapter specific column 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 22d7791dec..cf93eb052b 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/migration/join_table" require "active_support/core_ext/string/access" require "digest" diff --git a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb index 19b7821494..013cf5bfb6 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters class TransactionState diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 85d6fbe8b3..820803f715 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/type" require "active_record/connection_adapters/determine_if_preparable_visitor" require "active_record/connection_adapters/schema_cache" diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index 183f0f3c1b..4e29801d3e 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/connection_adapters/abstract_adapter" require "active_record/connection_adapters/statement_pool" require "active_record/connection_adapters/mysql/column" diff --git a/activerecord/lib/active_record/connection_adapters/column.rb b/activerecord/lib/active_record/connection_adapters/column.rb index 61cd7ae4cc..34eca70253 100644 --- a/activerecord/lib/active_record/connection_adapters/column.rb +++ b/activerecord/lib/active_record/connection_adapters/column.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # :stopdoc: module ConnectionAdapters diff --git a/activerecord/lib/active_record/connection_adapters/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/connection_specification.rb index 3e4ea28f63..de54787458 100644 --- a/activerecord/lib/active_record/connection_adapters/connection_specification.rb +++ b/activerecord/lib/active_record/connection_adapters/connection_specification.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "uri" module ActiveRecord diff --git a/activerecord/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb b/activerecord/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb index 0fdc185c45..e57147221f 100644 --- a/activerecord/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb +++ b/activerecord/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module DetermineIfPreparableVisitor diff --git a/activerecord/lib/active_record/connection_adapters/mysql/column.rb b/activerecord/lib/active_record/connection_adapters/mysql/column.rb index c9ad47c035..8bdc2a1622 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/column.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/column.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb index 9f1021456b..733b4ce734 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb b/activerecord/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb index 9691060cd3..f174ba5b0e 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb b/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb index d4f5906b33..9fcf1e0a89 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb index 083cd6340f..285aed12e2 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb index 6d88c14d50..b62b857bb7 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb index f21b2546de..1748bceb4e 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb index fc57e41fc9..7d6fa4b60a 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql/type_metadata.rb b/activerecord/lib/active_record/connection_adapters/mysql/type_metadata.rb index 9ad6a6c0d0..aa4d98e06b 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/type_metadata.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/type_metadata.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb index af55cfe2f6..350a99a2e4 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/connection_adapters/abstract_mysql_adapter" require "active_record/connection_adapters/mysql/database_statements" diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb index 3ad1911a28..36382b6d57 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters # PostgreSQL-specific extensions to column definitions in a table. diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb index ebf1715ed0..659b860cce 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb b/activerecord/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb index 99f3a5bbdf..21d0b4a0d2 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb index 4098250f3e..ea07b48430 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/connection_adapters/postgresql/oid/array" require "active_record/connection_adapters/postgresql/oid/bit" require "active_record/connection_adapters/postgresql/oid/bit_varying" diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb index a73a8c1726..fd629012ec 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit.rb index 0a505f46a7..70e84d85c2 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb index 4c21097d48..b4ea3b4edd 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb index 702fa8175c..4902a64330 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/cidr.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/cidr.rb index 5225609e37..2007665ec0 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/cidr.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "ipaddr" module ActiveRecord diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb index b7acbf7178..110771e7a2 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/decimal.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/decimal.rb index 43d22c8daf..bc720a36c8 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/decimal.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/decimal.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/enum.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/enum.rb index 950d23d516..db1cd22b48 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/enum.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/enum.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb index 49dd4fc73f..828bcd23dd 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/inet.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/inet.rb index 96486fa65b..4cc78a8c10 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/inet.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/inet.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb index 3c706c27c4..bb0f8487fa 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb index a1fec289d4..fcb6c1498d 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb index 775eecaf85..3ed9fefee8 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb index 7a91272d1c..cc3e0c9169 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/oid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/oid.rb index 9c2ac08b30..d8b47e8e29 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/oid.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/oid.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb index 7c764e7287..3275f28d0c 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord Point = Struct.new(:x, :y) diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/range.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/range.rb index 54d5d0902e..eddb0fb0ac 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/range.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/range.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb index 564e82a4ac..f5270a64ab 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb index d9ae1aa7a2..503691f7fc 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb index 5e839228e9..2fdf3b5d8e 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/vector.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/vector.rb index b26e876b54..6d86a221a7 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/vector.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/vector.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/xml.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/xml.rb index d40d837cee..f0e21f9f23 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/xml.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/xml.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb index 44eb666965..9ffa81ec59 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb b/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb index 44a7338bf5..3387bad79f 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_creation.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_creation.rb index e1d5089115..5fab6f60d2 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_creation.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_creation.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb index 11ea1e5144..32b7239f54 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb index 5555a46b6b..a631e4534f 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL 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 7aa034f901..b746304c27 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/string/strip" module ActiveRecord diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb b/activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb index f57179ae59..110cc88872 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters class PostgreSQLTypeMetadata < DelegateClass(SqlTypeMetadata) diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/utils.rb b/activerecord/lib/active_record/connection_adapters/postgresql/utils.rb index aa7940188a..6a4d6d50bd 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/utils.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/utils.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 99edbe486f..edf313f49d 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Make sure we're using pg high enough for type casts and Ruby 2.2+ compatibility gem "pg", "~> 0.18" require "pg" diff --git a/activerecord/lib/active_record/connection_adapters/schema_cache.rb b/activerecord/lib/active_record/connection_adapters/schema_cache.rb index 4d339b0a8c..32aa9d803b 100644 --- a/activerecord/lib/active_record/connection_adapters/schema_cache.rb +++ b/activerecord/lib/active_record/connection_adapters/schema_cache.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters class SchemaCache diff --git a/activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb b/activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb index 9e12ae0de8..e6908e9846 100644 --- a/activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb +++ b/activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # :stopdoc: module ConnectionAdapters diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb index 6fe3e1211e..01cfafdd2b 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module SQLite3 diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb index 7276a65098..c5bc797d48 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module SQLite3 diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_creation.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_creation.rb index bc798d1dbb..bcd43eac08 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_creation.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_creation.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module SQLite3 diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb index e157e4b218..7bbda675eb 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module SQLite3 diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb index eec018eda3..d265a60206 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module SQLite3 diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb index e02491edb6..9c10970d34 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module SQLite3 diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index ee2faf43b5..c4cbdb588c 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/connection_adapters/abstract_adapter" require "active_record/connection_adapters/statement_pool" require "active_record/connection_adapters/sqlite3/explain_pretty_printer" diff --git a/activerecord/lib/active_record/connection_adapters/statement_pool.rb b/activerecord/lib/active_record/connection_adapters/statement_pool.rb index 790db56185..e7c237d42f 100644 --- a/activerecord/lib/active_record/connection_adapters/statement_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/statement_pool.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters class StatementPool # :nodoc: diff --git a/activerecord/lib/active_record/connection_handling.rb b/activerecord/lib/active_record/connection_handling.rb index b8fbb489b6..61f160b99d 100644 --- a/activerecord/lib/active_record/connection_handling.rb +++ b/activerecord/lib/active_record/connection_handling.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionHandling RAILS_ENV = -> { (Rails.env if defined?(Rails.env)) || ENV["RAILS_ENV"].presence || ENV["RACK_ENV"].presence } diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 198c712abc..f1eaa07f1a 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "thread" require "active_support/core_ext/hash/indifferent_access" require "active_support/core_ext/object/duplicable" diff --git a/activerecord/lib/active_record/counter_cache.rb b/activerecord/lib/active_record/counter_cache.rb index cbd71a3779..5dcd28244a 100644 --- a/activerecord/lib/active_record/counter_cache.rb +++ b/activerecord/lib/active_record/counter_cache.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record Counter Cache module CounterCache diff --git a/activerecord/lib/active_record/define_callbacks.rb b/activerecord/lib/active_record/define_callbacks.rb index 7d955a24be..291ebd3678 100644 --- a/activerecord/lib/active_record/define_callbacks.rb +++ b/activerecord/lib/active_record/define_callbacks.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # This module exists because `ActiveRecord::AttributeMethods::Dirty` needs to # define callbacks, but continue to have its version of `save` be the super diff --git a/activerecord/lib/active_record/dynamic_matchers.rb b/activerecord/lib/active_record/dynamic_matchers.rb index 3a9625092e..a3425c8097 100644 --- a/activerecord/lib/active_record/dynamic_matchers.rb +++ b/activerecord/lib/active_record/dynamic_matchers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module DynamicMatchers #:nodoc: private diff --git a/activerecord/lib/active_record/enum.rb b/activerecord/lib/active_record/enum.rb index 12ef58a941..86ffa28306 100644 --- a/activerecord/lib/active_record/enum.rb +++ b/activerecord/lib/active_record/enum.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/object/deep_dup" module ActiveRecord diff --git a/activerecord/lib/active_record/errors.rb b/activerecord/lib/active_record/errors.rb index 60d4fb70e0..7507d61535 100644 --- a/activerecord/lib/active_record/errors.rb +++ b/activerecord/lib/active_record/errors.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record Errors # diff --git a/activerecord/lib/active_record/explain.rb b/activerecord/lib/active_record/explain.rb index 8f7ae2c33c..c6a9e2a67c 100644 --- a/activerecord/lib/active_record/explain.rb +++ b/activerecord/lib/active_record/explain.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/explain_registry" module ActiveRecord diff --git a/activerecord/lib/active_record/explain_registry.rb b/activerecord/lib/active_record/explain_registry.rb index ef1ce3dc85..0af48be6fd 100644 --- a/activerecord/lib/active_record/explain_registry.rb +++ b/activerecord/lib/active_record/explain_registry.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/per_thread_registry" module ActiveRecord diff --git a/activerecord/lib/active_record/explain_subscriber.rb b/activerecord/lib/active_record/explain_subscriber.rb index abd8cfc8f2..07a412a8a1 100644 --- a/activerecord/lib/active_record/explain_subscriber.rb +++ b/activerecord/lib/active_record/explain_subscriber.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/notifications" require "active_record/explain_registry" diff --git a/activerecord/lib/active_record/fixture_set/file.rb b/activerecord/lib/active_record/fixture_set/file.rb index 6cf2e01179..93b8ba07e9 100644 --- a/activerecord/lib/active_record/fixture_set/file.rb +++ b/activerecord/lib/active_record/fixture_set/file.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "erb" require "yaml" diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index e9acb8acae..1835965b7f 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "erb" require "yaml" require "zlib" diff --git a/activerecord/lib/active_record/gem_version.rb b/activerecord/lib/active_record/gem_version.rb index 1a937dbcf7..a0434766f5 100644 --- a/activerecord/lib/active_record/gem_version.rb +++ b/activerecord/lib/active_record/gem_version.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # Returns the version of the currently loaded Active Record as a Gem::Version def self.gem_version diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb index 5776807507..10911b9a3e 100644 --- a/activerecord/lib/active_record/inheritance.rb +++ b/activerecord/lib/active_record/inheritance.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/hash/indifferent_access" module ActiveRecord diff --git a/activerecord/lib/active_record/integration.rb b/activerecord/lib/active_record/integration.rb index cf954852bc..2bb96457c6 100644 --- a/activerecord/lib/active_record/integration.rb +++ b/activerecord/lib/active_record/integration.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/string/filters" module ActiveRecord diff --git a/activerecord/lib/active_record/internal_metadata.rb b/activerecord/lib/active_record/internal_metadata.rb index 25ee9d6bfe..9ec6b51cb3 100644 --- a/activerecord/lib/active_record/internal_metadata.rb +++ b/activerecord/lib/active_record/internal_metadata.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/scoping/default" require "active_record/scoping/named" diff --git a/activerecord/lib/active_record/legacy_yaml_adapter.rb b/activerecord/lib/active_record/legacy_yaml_adapter.rb index c7683f68c7..ba74f1a56c 100644 --- a/activerecord/lib/active_record/legacy_yaml_adapter.rb +++ b/activerecord/lib/active_record/legacy_yaml_adapter.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module LegacyYamlAdapter def self.convert(klass, coder) diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 522da6a571..2e2f2979d8 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Locking # == What is Optimistic Locking diff --git a/activerecord/lib/active_record/locking/pessimistic.rb b/activerecord/lib/active_record/locking/pessimistic.rb index 263e2a5f7f..0fb4dc3a35 100644 --- a/activerecord/lib/active_record/locking/pessimistic.rb +++ b/activerecord/lib/active_record/locking/pessimistic.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Locking # Locking::Pessimistic provides support for row-level locking using diff --git a/activerecord/lib/active_record/log_subscriber.rb b/activerecord/lib/active_record/log_subscriber.rb index e39ca5f6dc..e8593c1a48 100644 --- a/activerecord/lib/active_record/log_subscriber.rb +++ b/activerecord/lib/active_record/log_subscriber.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class LogSubscriber < ActiveSupport::LogSubscriber IGNORE_PAYLOAD_NAMES = ["SCHEMA", "EXPLAIN"] diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 51c82f4ced..f83842958c 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "set" require "zlib" require "active_support/core_ext/module/attribute_accessors" diff --git a/activerecord/lib/active_record/migration/command_recorder.rb b/activerecord/lib/active_record/migration/command_recorder.rb index f9cf59b283..1641044841 100644 --- a/activerecord/lib/active_record/migration/command_recorder.rb +++ b/activerecord/lib/active_record/migration/command_recorder.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class Migration # ActiveRecord::Migration::CommandRecorder records commands done during diff --git a/activerecord/lib/active_record/migration/compatibility.rb b/activerecord/lib/active_record/migration/compatibility.rb index 188dd0acef..ccb1b2ddd7 100644 --- a/activerecord/lib/active_record/migration/compatibility.rb +++ b/activerecord/lib/active_record/migration/compatibility.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class Migration module Compatibility # :nodoc: all diff --git a/activerecord/lib/active_record/migration/join_table.rb b/activerecord/lib/active_record/migration/join_table.rb index 89789f00ea..026217880c 100644 --- a/activerecord/lib/active_record/migration/join_table.rb +++ b/activerecord/lib/active_record/migration/join_table.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class Migration module JoinTable #:nodoc: diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb index 14e0f5bff7..e846bcc1a1 100644 --- a/activerecord/lib/active_record/model_schema.rb +++ b/activerecord/lib/active_record/model_schema.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "monitor" module ActiveRecord diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index 917bc76993..43d4364e35 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/hash/except" require "active_support/core_ext/object/try" require "active_support/core_ext/hash/indifferent_access" diff --git a/activerecord/lib/active_record/no_touching.rb b/activerecord/lib/active_record/no_touching.rb index 4059020e25..84ee036c17 100644 --- a/activerecord/lib/active_record/no_touching.rb +++ b/activerecord/lib/active_record/no_touching.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record No Touching module NoTouching diff --git a/activerecord/lib/active_record/null_relation.rb b/activerecord/lib/active_record/null_relation.rb index 26966f9433..6d65154a14 100644 --- a/activerecord/lib/active_record/null_relation.rb +++ b/activerecord/lib/active_record/null_relation.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module NullRelation # :nodoc: def pluck(*column_names) diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index b2dba5516e..c310ae3575 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record \Persistence module Persistence diff --git a/activerecord/lib/active_record/query_cache.rb b/activerecord/lib/active_record/query_cache.rb index e4c2e1f86f..17e6bbfec0 100644 --- a/activerecord/lib/active_record/query_cache.rb +++ b/activerecord/lib/active_record/query_cache.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record Query Cache class QueryCache diff --git a/activerecord/lib/active_record/querying.rb b/activerecord/lib/active_record/querying.rb index b16e178358..dd7d833a96 100644 --- a/activerecord/lib/active_record/querying.rb +++ b/activerecord/lib/active_record/querying.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Querying delegate :find, :take, :take!, :first, :first!, :last, :last!, :exists?, :any?, :many?, :none?, :one?, to: :all diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 73518ca144..441dca9fe7 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record" require "rails" require "active_model/railtie" diff --git a/activerecord/lib/active_record/railties/console_sandbox.rb b/activerecord/lib/active_record/railties/console_sandbox.rb index 604a220303..03286eacbb 100644 --- a/activerecord/lib/active_record/railties/console_sandbox.rb +++ b/activerecord/lib/active_record/railties/console_sandbox.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true ActiveRecord::Base.connection.begin_transaction(joinable: false) at_exit do diff --git a/activerecord/lib/active_record/railties/controller_runtime.rb b/activerecord/lib/active_record/railties/controller_runtime.rb index 8658188623..297f3fc8bc 100644 --- a/activerecord/lib/active_record/railties/controller_runtime.rb +++ b/activerecord/lib/active_record/railties/controller_runtime.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/module/attr_internal" require "active_record/log_subscriber" diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index 711099e9e1..7c0d066e88 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record" db_namespace = namespace :db do diff --git a/activerecord/lib/active_record/railties/jdbcmysql_error.rb b/activerecord/lib/active_record/railties/jdbcmysql_error.rb index d7cf4df339..f614c067d7 100644 --- a/activerecord/lib/active_record/railties/jdbcmysql_error.rb +++ b/activerecord/lib/active_record/railties/jdbcmysql_error.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true #FIXME Remove if ArJdbcMysql will give. module ArJdbcMySQL #:nodoc: class Error < StandardError #:nodoc: diff --git a/activerecord/lib/active_record/readonly_attributes.rb b/activerecord/lib/active_record/readonly_attributes.rb index af6473d250..7bf305eb31 100644 --- a/activerecord/lib/active_record/readonly_attributes.rb +++ b/activerecord/lib/active_record/readonly_attributes.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ReadonlyAttributes extend ActiveSupport::Concern diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 73761ed7ed..be76256186 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "thread" require "active_support/core_ext/string/filters" require "active_support/deprecation" diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 52f5d5f3e3..55b59eeb54 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record \Relation class Relation diff --git a/activerecord/lib/active_record/relation/batches.rb b/activerecord/lib/active_record/relation/batches.rb index 13a2c3f511..ac48ffb1bc 100644 --- a/activerecord/lib/active_record/relation/batches.rb +++ b/activerecord/lib/active_record/relation/batches.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/relation/batches/batch_enumerator" module ActiveRecord diff --git a/activerecord/lib/active_record/relation/batches/batch_enumerator.rb b/activerecord/lib/active_record/relation/batches/batch_enumerator.rb index 3555779ec2..02c70d5cf0 100644 --- a/activerecord/lib/active_record/relation/batches/batch_enumerator.rb +++ b/activerecord/lib/active_record/relation/batches/batch_enumerator.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Batches class BatchEnumerator diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 8a54f8f2c3..6514c7bde8 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Calculations # Count the records. diff --git a/activerecord/lib/active_record/relation/delegation.rb b/activerecord/lib/active_record/relation/delegation.rb index 48c4dcdef4..6d3b59d339 100644 --- a/activerecord/lib/active_record/relation/delegation.rb +++ b/activerecord/lib/active_record/relation/delegation.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Delegation # :nodoc: module DelegateCache # :nodoc: diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index df8909379f..caa65af50c 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/string/filters" module ActiveRecord diff --git a/activerecord/lib/active_record/relation/from_clause.rb b/activerecord/lib/active_record/relation/from_clause.rb index 8945cb0cc5..ea838b79a6 100644 --- a/activerecord/lib/active_record/relation/from_clause.rb +++ b/activerecord/lib/active_record/relation/from_clause.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class Relation class FromClause # :nodoc: diff --git a/activerecord/lib/active_record/relation/merger.rb b/activerecord/lib/active_record/relation/merger.rb index 5dac00724a..84c31e4126 100644 --- a/activerecord/lib/active_record/relation/merger.rb +++ b/activerecord/lib/active_record/relation/merger.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/hash/keys" module ActiveRecord diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index 7dea5deec5..72314180dd 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class PredicateBuilder # :nodoc: delegate :resolve_column_aliases, to: :table diff --git a/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb b/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb index 1068e700e2..4d0778df36 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class PredicateBuilder class ArrayHandler # :nodoc: diff --git a/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb b/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb index 3e19646ae5..66690d6b5c 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class PredicateBuilder class AssociationQueryValue # :nodoc: diff --git a/activerecord/lib/active_record/relation/predicate_builder/base_handler.rb b/activerecord/lib/active_record/relation/predicate_builder/base_handler.rb index 3bb1037885..3472b16cef 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/base_handler.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/base_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class PredicateBuilder class BaseHandler # :nodoc: diff --git a/activerecord/lib/active_record/relation/predicate_builder/basic_object_handler.rb b/activerecord/lib/active_record/relation/predicate_builder/basic_object_handler.rb index 79cde00303..3190602506 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/basic_object_handler.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/basic_object_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class PredicateBuilder class BasicObjectHandler # :nodoc: diff --git a/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb b/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb index 7029ae5f47..5032177757 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class PredicateBuilder class PolymorphicArrayValue # :nodoc: diff --git a/activerecord/lib/active_record/relation/predicate_builder/range_handler.rb b/activerecord/lib/active_record/relation/predicate_builder/range_handler.rb index 5db778e19c..ddd804b508 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/range_handler.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/range_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class PredicateBuilder class RangeHandler # :nodoc: diff --git a/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb b/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb index 8a910a82fe..4e1e644599 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class PredicateBuilder class RelationHandler # :nodoc: diff --git a/activerecord/lib/active_record/relation/query_attribute.rb b/activerecord/lib/active_record/relation/query_attribute.rb index a68e508fcc..410a375e52 100644 --- a/activerecord/lib/active_record/relation/query_attribute.rb +++ b/activerecord/lib/active_record/relation/query_attribute.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/attribute" module ActiveRecord diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index d44f6fd572..4ddc933e3d 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/relation/from_clause" require "active_record/relation/query_attribute" require "active_record/relation/where_clause" diff --git a/activerecord/lib/active_record/relation/record_fetch_warning.rb b/activerecord/lib/active_record/relation/record_fetch_warning.rb index 31544c730e..8e221f1570 100644 --- a/activerecord/lib/active_record/relation/record_fetch_warning.rb +++ b/activerecord/lib/active_record/relation/record_fetch_warning.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class Relation module RecordFetchWarning diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb index ada89b5ec3..8b7b01259e 100644 --- a/activerecord/lib/active_record/relation/spawn_methods.rb +++ b/activerecord/lib/active_record/relation/spawn_methods.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/hash/except" require "active_support/core_ext/hash/slice" require "active_record/relation/merger" diff --git a/activerecord/lib/active_record/relation/where_clause.rb b/activerecord/lib/active_record/relation/where_clause.rb index 119910ee79..a809752928 100644 --- a/activerecord/lib/active_record/relation/where_clause.rb +++ b/activerecord/lib/active_record/relation/where_clause.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class Relation class WhereClause # :nodoc: diff --git a/activerecord/lib/active_record/relation/where_clause_factory.rb b/activerecord/lib/active_record/relation/where_clause_factory.rb index b862dd56a5..156088f534 100644 --- a/activerecord/lib/active_record/relation/where_clause_factory.rb +++ b/activerecord/lib/active_record/relation/where_clause_factory.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class Relation class WhereClauseFactory # :nodoc: diff --git a/activerecord/lib/active_record/result.rb b/activerecord/lib/active_record/result.rb index 26b1d48e9e..5e1c0bfefc 100644 --- a/activerecord/lib/active_record/result.rb +++ b/activerecord/lib/active_record/result.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord ### # This class encapsulates a result returned from calling diff --git a/activerecord/lib/active_record/runtime_registry.rb b/activerecord/lib/active_record/runtime_registry.rb index b79eb2263f..d068d8898e 100644 --- a/activerecord/lib/active_record/runtime_registry.rb +++ b/activerecord/lib/active_record/runtime_registry.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/per_thread_registry" module ActiveRecord diff --git a/activerecord/lib/active_record/sanitization.rb b/activerecord/lib/active_record/sanitization.rb index 64bda1539c..a39e1a2e73 100644 --- a/activerecord/lib/active_record/sanitization.rb +++ b/activerecord/lib/active_record/sanitization.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Sanitization extend ActiveSupport::Concern diff --git a/activerecord/lib/active_record/schema.rb b/activerecord/lib/active_record/schema.rb index 5104427339..2578c5e3ef 100644 --- a/activerecord/lib/active_record/schema.rb +++ b/activerecord/lib/active_record/schema.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record \Schema # diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index 66a2846f3a..767da6816d 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "stringio" module ActiveRecord diff --git a/activerecord/lib/active_record/schema_migration.rb b/activerecord/lib/active_record/schema_migration.rb index f59737afb0..e6336dfde3 100644 --- a/activerecord/lib/active_record/schema_migration.rb +++ b/activerecord/lib/active_record/schema_migration.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/scoping/default" require "active_record/scoping/named" diff --git a/activerecord/lib/active_record/scoping.rb b/activerecord/lib/active_record/scoping.rb index 94e0ef6724..c2cd35ee3b 100644 --- a/activerecord/lib/active_record/scoping.rb +++ b/activerecord/lib/active_record/scoping.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/per_thread_registry" module ActiveRecord diff --git a/activerecord/lib/active_record/scoping/default.rb b/activerecord/lib/active_record/scoping/default.rb index 70b2693b28..eeb89c405a 100644 --- a/activerecord/lib/active_record/scoping/default.rb +++ b/activerecord/lib/active_record/scoping/default.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Scoping module Default diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb index b4026fabb2..c16cbce109 100644 --- a/activerecord/lib/active_record/scoping/named.rb +++ b/activerecord/lib/active_record/scoping/named.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/array" require "active_support/core_ext/hash/except" require "active_support/core_ext/kernel/singleton_class" diff --git a/activerecord/lib/active_record/secure_token.rb b/activerecord/lib/active_record/secure_token.rb index 115799cc20..3b2d7e10bd 100644 --- a/activerecord/lib/active_record/secure_token.rb +++ b/activerecord/lib/active_record/secure_token.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module SecureToken extend ActiveSupport::Concern diff --git a/activerecord/lib/active_record/serialization.rb b/activerecord/lib/active_record/serialization.rb index db2bd0b55e..1907defb2e 100644 --- a/activerecord/lib/active_record/serialization.rb +++ b/activerecord/lib/active_record/serialization.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord #:nodoc: # = Active Record \Serialization module Serialization diff --git a/activerecord/lib/active_record/statement_cache.rb b/activerecord/lib/active_record/statement_cache.rb index 1877489e55..fd04f9aedb 100644 --- a/activerecord/lib/active_record/statement_cache.rb +++ b/activerecord/lib/active_record/statement_cache.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # Statement cache is used to cache a single statement in order to avoid creating the AST again. # Initializing the cache is done by passing the statement in the create block: diff --git a/activerecord/lib/active_record/store.rb b/activerecord/lib/active_record/store.rb index 006afe7495..37888c28b5 100644 --- a/activerecord/lib/active_record/store.rb +++ b/activerecord/lib/active_record/store.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/hash/indifferent_access" module ActiveRecord diff --git a/activerecord/lib/active_record/suppressor.rb b/activerecord/lib/active_record/suppressor.rb index d9acb1a1dc..02185c2e0b 100644 --- a/activerecord/lib/active_record/suppressor.rb +++ b/activerecord/lib/active_record/suppressor.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # ActiveRecord::Suppressor prevents the receiver from being saved during # a given block. diff --git a/activerecord/lib/active_record/table_metadata.rb b/activerecord/lib/active_record/table_metadata.rb index 71efc1829a..a5dd3008d0 100644 --- a/activerecord/lib/active_record/table_metadata.rb +++ b/activerecord/lib/active_record/table_metadata.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord class TableMetadata # :nodoc: delegate :foreign_type, :foreign_key, to: :association, prefix: true diff --git a/activerecord/lib/active_record/tasks/database_tasks.rb b/activerecord/lib/active_record/tasks/database_tasks.rb index ba686fc562..bdfa683be4 100644 --- a/activerecord/lib/active_record/tasks/database_tasks.rb +++ b/activerecord/lib/active_record/tasks/database_tasks.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Tasks # :nodoc: class DatabaseAlreadyExists < StandardError; end # :nodoc: diff --git a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb index c25d87dd3e..447bf09a4f 100644 --- a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Tasks # :nodoc: class MySQLDatabaseTasks # :nodoc: diff --git a/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb b/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb index 7f1a768d8b..e49480b27b 100644 --- a/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "tempfile" module ActiveRecord diff --git a/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb b/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb index 01562b21e9..559142b57a 100644 --- a/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Tasks # :nodoc: class SQLiteDatabaseTasks # :nodoc: diff --git a/activerecord/lib/active_record/touch_later.rb b/activerecord/lib/active_record/touch_later.rb index cacde9c881..1e484e59e3 100644 --- a/activerecord/lib/active_record/touch_later.rb +++ b/activerecord/lib/active_record/touch_later.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record Touch Later module TouchLater diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb index 45795fa287..4e8d2a44e1 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # See ActiveRecord::Transactions::ClassMethods for documentation. module Transactions diff --git a/activerecord/lib/active_record/translation.rb b/activerecord/lib/active_record/translation.rb index ddcb5f2a7a..ecc508902c 100644 --- a/activerecord/lib/active_record/translation.rb +++ b/activerecord/lib/active_record/translation.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Translation include ActiveModel::Translation diff --git a/activerecord/lib/active_record/type.rb b/activerecord/lib/active_record/type.rb index 9ed6c95bf9..a179582e13 100644 --- a/activerecord/lib/active_record/type.rb +++ b/activerecord/lib/active_record/type.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_model/type" require "active_record/type/internal/timezone" diff --git a/activerecord/lib/active_record/type/adapter_specific_registry.rb b/activerecord/lib/active_record/type/adapter_specific_registry.rb index 7cc866f7a7..f24b9b9a36 100644 --- a/activerecord/lib/active_record/type/adapter_specific_registry.rb +++ b/activerecord/lib/active_record/type/adapter_specific_registry.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_model/type/registry" module ActiveRecord diff --git a/activerecord/lib/active_record/type/date.rb b/activerecord/lib/active_record/type/date.rb index ccafed054e..f1a40a8a6b 100644 --- a/activerecord/lib/active_record/type/date.rb +++ b/activerecord/lib/active_record/type/date.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Type class Date < ActiveModel::Type::Date diff --git a/activerecord/lib/active_record/type/date_time.rb b/activerecord/lib/active_record/type/date_time.rb index 1fb9380ecd..dadd76dbe0 100644 --- a/activerecord/lib/active_record/type/date_time.rb +++ b/activerecord/lib/active_record/type/date_time.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Type class DateTime < ActiveModel::Type::DateTime diff --git a/activerecord/lib/active_record/type/decimal_without_scale.rb b/activerecord/lib/active_record/type/decimal_without_scale.rb index 53a5e205da..ed0a4cfb23 100644 --- a/activerecord/lib/active_record/type/decimal_without_scale.rb +++ b/activerecord/lib/active_record/type/decimal_without_scale.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Type class DecimalWithoutScale < ActiveModel::Type::BigInteger # :nodoc: diff --git a/activerecord/lib/active_record/type/hash_lookup_type_map.rb b/activerecord/lib/active_record/type/hash_lookup_type_map.rb index 0145d5d6c1..96b6297132 100644 --- a/activerecord/lib/active_record/type/hash_lookup_type_map.rb +++ b/activerecord/lib/active_record/type/hash_lookup_type_map.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Type class HashLookupTypeMap < TypeMap # :nodoc: diff --git a/activerecord/lib/active_record/type/internal/timezone.rb b/activerecord/lib/active_record/type/internal/timezone.rb index 947e06158a..0c7d8ed76e 100644 --- a/activerecord/lib/active_record/type/internal/timezone.rb +++ b/activerecord/lib/active_record/type/internal/timezone.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Type module Internal diff --git a/activerecord/lib/active_record/type/json.rb b/activerecord/lib/active_record/type/json.rb index c4732fe388..9aec74241b 100644 --- a/activerecord/lib/active_record/type/json.rb +++ b/activerecord/lib/active_record/type/json.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Type class Json < ActiveModel::Type::Value diff --git a/activerecord/lib/active_record/type/serialized.rb b/activerecord/lib/active_record/type/serialized.rb index edbd20a6c1..96e7ad7152 100644 --- a/activerecord/lib/active_record/type/serialized.rb +++ b/activerecord/lib/active_record/type/serialized.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Type class Serialized < DelegateClass(ActiveModel::Type::Value) # :nodoc: diff --git a/activerecord/lib/active_record/type/text.rb b/activerecord/lib/active_record/type/text.rb index cb1949700a..3d7dd630e3 100644 --- a/activerecord/lib/active_record/type/text.rb +++ b/activerecord/lib/active_record/type/text.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Type class Text < ActiveModel::Type::String # :nodoc: diff --git a/activerecord/lib/active_record/type/time.rb b/activerecord/lib/active_record/type/time.rb index b9bac87c67..3ca7010c79 100644 --- a/activerecord/lib/active_record/type/time.rb +++ b/activerecord/lib/active_record/type/time.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Type class Time < ActiveModel::Type::Time diff --git a/activerecord/lib/active_record/type/type_map.rb b/activerecord/lib/active_record/type/type_map.rb index 7bce82a1ff..f28caff991 100644 --- a/activerecord/lib/active_record/type/type_map.rb +++ b/activerecord/lib/active_record/type/type_map.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "concurrent/map" module ActiveRecord diff --git a/activerecord/lib/active_record/type/unsigned_integer.rb b/activerecord/lib/active_record/type/unsigned_integer.rb index 9ae0109f9f..45f5dc506e 100644 --- a/activerecord/lib/active_record/type/unsigned_integer.rb +++ b/activerecord/lib/active_record/type/unsigned_integer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Type class UnsignedInteger < ActiveModel::Type::Integer # :nodoc: diff --git a/activerecord/lib/active_record/type_caster.rb b/activerecord/lib/active_record/type_caster.rb index f1686e4913..dbe91dc12b 100644 --- a/activerecord/lib/active_record/type_caster.rb +++ b/activerecord/lib/active_record/type_caster.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record/type_caster/map" require "active_record/type_caster/connection" diff --git a/activerecord/lib/active_record/type_caster/connection.rb b/activerecord/lib/active_record/type_caster/connection.rb index 9f7bbe8843..4f4570db58 100644 --- a/activerecord/lib/active_record/type_caster/connection.rb +++ b/activerecord/lib/active_record/type_caster/connection.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module TypeCaster class Connection # :nodoc: diff --git a/activerecord/lib/active_record/type_caster/map.rb b/activerecord/lib/active_record/type_caster/map.rb index 9f79723125..fd3477a826 100644 --- a/activerecord/lib/active_record/type_caster/map.rb +++ b/activerecord/lib/active_record/type_caster/map.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module TypeCaster class Map # :nodoc: diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index 9633f226f0..4727221774 100644 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord # = Active Record \RecordInvalid # diff --git a/activerecord/lib/active_record/validations/absence.rb b/activerecord/lib/active_record/validations/absence.rb index 641d041f3d..57fbdb92ee 100644 --- a/activerecord/lib/active_record/validations/absence.rb +++ b/activerecord/lib/active_record/validations/absence.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Validations class AbsenceValidator < ActiveModel::Validations::AbsenceValidator # :nodoc: diff --git a/activerecord/lib/active_record/validations/associated.rb b/activerecord/lib/active_record/validations/associated.rb index c695965d7b..d7752b428b 100644 --- a/activerecord/lib/active_record/validations/associated.rb +++ b/activerecord/lib/active_record/validations/associated.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Validations class AssociatedValidator < ActiveModel::EachValidator #:nodoc: diff --git a/activerecord/lib/active_record/validations/length.rb b/activerecord/lib/active_record/validations/length.rb index 0e0cebce4a..82a17b4807 100644 --- a/activerecord/lib/active_record/validations/length.rb +++ b/activerecord/lib/active_record/validations/length.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Validations class LengthValidator < ActiveModel::Validations::LengthValidator # :nodoc: diff --git a/activerecord/lib/active_record/validations/presence.rb b/activerecord/lib/active_record/validations/presence.rb index 7cfd55f516..a8f8bc6b02 100644 --- a/activerecord/lib/active_record/validations/presence.rb +++ b/activerecord/lib/active_record/validations/presence.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Validations class PresenceValidator < ActiveModel::Validations::PresenceValidator # :nodoc: diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb index 154cf5f1a4..86eeb5d7c5 100644 --- a/activerecord/lib/active_record/validations/uniqueness.rb +++ b/activerecord/lib/active_record/validations/uniqueness.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module Validations class UniquenessValidator < ActiveModel::EachValidator # :nodoc: diff --git a/activerecord/lib/active_record/version.rb b/activerecord/lib/active_record/version.rb index 146cfacc18..78e9169b2e 100644 --- a/activerecord/lib/active_record/version.rb +++ b/activerecord/lib/active_record/version.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require_relative "gem_version" module ActiveRecord diff --git a/activerecord/lib/rails/generators/active_record.rb b/activerecord/lib/rails/generators/active_record.rb index a79b8eafea..aaa2a14702 100644 --- a/activerecord/lib/rails/generators/active_record.rb +++ b/activerecord/lib/rails/generators/active_record.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "rails/generators/named_base" require "rails/generators/active_model" require "rails/generators/active_record/migration" diff --git a/activerecord/lib/rails/generators/active_record/migration.rb b/activerecord/lib/rails/generators/active_record/migration.rb index 47c0981a49..6d07438dcb 100644 --- a/activerecord/lib/rails/generators/active_record/migration.rb +++ b/activerecord/lib/rails/generators/active_record/migration.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "rails/generators/migration" module ActiveRecord diff --git a/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb b/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb index 1f1c47499b..61f507ddb3 100644 --- a/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb +++ b/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "rails/generators/active_record" module ActiveRecord diff --git a/activerecord/lib/rails/generators/active_record/model/model_generator.rb b/activerecord/lib/rails/generators/active_record/model/model_generator.rb index 5cec07d2e3..ee321089af 100644 --- a/activerecord/lib/rails/generators/active_record/model/model_generator.rb +++ b/activerecord/lib/rails/generators/active_record/model/model_generator.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "rails/generators/active_record" module ActiveRecord diff --git a/activerecord/test/active_record/connection_adapters/fake_adapter.rb b/activerecord/test/active_record/connection_adapters/fake_adapter.rb index b0d8050721..9391569f2f 100644 --- a/activerecord/test/active_record/connection_adapters/fake_adapter.rb +++ b/activerecord/test/active_record/connection_adapters/fake_adapter.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionHandling def fake_connection(config) diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb index a1fb6427f9..dd891cb2ed 100644 --- a/activerecord/test/cases/adapter_test.rb +++ b/activerecord/test/cases/adapter_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/book" require "models/post" diff --git a/activerecord/test/cases/adapters/mysql2/active_schema_test.rb b/activerecord/test/cases/adapters/mysql2/active_schema_test.rb index 67e1efde27..fdf83aaf88 100644 --- a/activerecord/test/cases/adapters/mysql2/active_schema_test.rb +++ b/activerecord/test/cases/adapters/mysql2/active_schema_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/mysql2/bind_parameter_test.rb b/activerecord/test/cases/adapters/mysql2/bind_parameter_test.rb index 8f7c803a21..9f3d1459f7 100644 --- a/activerecord/test/cases/adapters/mysql2/bind_parameter_test.rb +++ b/activerecord/test/cases/adapters/mysql2/bind_parameter_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" diff --git a/activerecord/test/cases/adapters/mysql2/boolean_test.rb b/activerecord/test/cases/adapters/mysql2/boolean_test.rb index 58698d59db..9267d15def 100644 --- a/activerecord/test/cases/adapters/mysql2/boolean_test.rb +++ b/activerecord/test/cases/adapters/mysql2/boolean_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class Mysql2BooleanTest < ActiveRecord::Mysql2TestCase diff --git a/activerecord/test/cases/adapters/mysql2/case_sensitivity_test.rb b/activerecord/test/cases/adapters/mysql2/case_sensitivity_test.rb index 50ba9ab831..65dc369213 100644 --- a/activerecord/test/cases/adapters/mysql2/case_sensitivity_test.rb +++ b/activerecord/test/cases/adapters/mysql2/case_sensitivity_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class Mysql2CaseSensitivityTest < ActiveRecord::Mysql2TestCase diff --git a/activerecord/test/cases/adapters/mysql2/charset_collation_test.rb b/activerecord/test/cases/adapters/mysql2/charset_collation_test.rb index e4a6ed5482..e77f4a90d4 100644 --- a/activerecord/test/cases/adapters/mysql2/charset_collation_test.rb +++ b/activerecord/test/cases/adapters/mysql2/charset_collation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/mysql2/connection_test.rb b/activerecord/test/cases/adapters/mysql2/connection_test.rb index a2faf43b0d..c5ff145e74 100644 --- a/activerecord/test/cases/adapters/mysql2/connection_test.rb +++ b/activerecord/test/cases/adapters/mysql2/connection_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/mysql2/datetime_precision_quoting_test.rb b/activerecord/test/cases/adapters/mysql2/datetime_precision_quoting_test.rb index c131a5169c..86e72c149c 100644 --- a/activerecord/test/cases/adapters/mysql2/datetime_precision_quoting_test.rb +++ b/activerecord/test/cases/adapters/mysql2/datetime_precision_quoting_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class Mysql2DatetimePrecisionQuotingTest < ActiveRecord::Mysql2TestCase diff --git a/activerecord/test/cases/adapters/mysql2/enum_test.rb b/activerecord/test/cases/adapters/mysql2/enum_test.rb index 7ad3e3ca2d..b811179c1b 100644 --- a/activerecord/test/cases/adapters/mysql2/enum_test.rb +++ b/activerecord/test/cases/adapters/mysql2/enum_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class Mysql2EnumTest < ActiveRecord::Mysql2TestCase diff --git a/activerecord/test/cases/adapters/mysql2/explain_test.rb b/activerecord/test/cases/adapters/mysql2/explain_test.rb index 7916921e5a..84c15af08d 100644 --- a/activerecord/test/cases/adapters/mysql2/explain_test.rb +++ b/activerecord/test/cases/adapters/mysql2/explain_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/computer" diff --git a/activerecord/test/cases/adapters/mysql2/json_test.rb b/activerecord/test/cases/adapters/mysql2/json_test.rb index 26c69edc7b..2d39db4ce2 100644 --- a/activerecord/test/cases/adapters/mysql2/json_test.rb +++ b/activerecord/test/cases/adapters/mysql2/json_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "cases/json_shared_test_cases" diff --git a/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb b/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb index 565130c38f..7ba388bee1 100644 --- a/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb +++ b/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/ddl_helper" diff --git a/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb b/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb index 251a50e41e..4a421e2b91 100644 --- a/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb +++ b/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class SchemaMigrationsTest < ActiveRecord::Mysql2TestCase diff --git a/activerecord/test/cases/adapters/mysql2/schema_test.rb b/activerecord/test/cases/adapters/mysql2/schema_test.rb index 1fad5585de..c4bf58c13e 100644 --- a/activerecord/test/cases/adapters/mysql2/schema_test.rb +++ b/activerecord/test/cases/adapters/mysql2/schema_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/adapters/mysql2/sp_test.rb b/activerecord/test/cases/adapters/mysql2/sp_test.rb index 4182532535..d4c4d02f79 100644 --- a/activerecord/test/cases/adapters/mysql2/sp_test.rb +++ b/activerecord/test/cases/adapters/mysql2/sp_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/cases/adapters/mysql2/sql_types_test.rb b/activerecord/test/cases/adapters/mysql2/sql_types_test.rb index d6e7f29a5c..c412166451 100644 --- a/activerecord/test/cases/adapters/mysql2/sql_types_test.rb +++ b/activerecord/test/cases/adapters/mysql2/sql_types_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class Mysql2SqlTypesTest < ActiveRecord::Mysql2TestCase diff --git a/activerecord/test/cases/adapters/mysql2/table_options_test.rb b/activerecord/test/cases/adapters/mysql2/table_options_test.rb index 61a8ce9bc0..54da2195d1 100644 --- a/activerecord/test/cases/adapters/mysql2/table_options_test.rb +++ b/activerecord/test/cases/adapters/mysql2/table_options_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/mysql2/transaction_test.rb b/activerecord/test/cases/adapters/mysql2/transaction_test.rb index 16101e38cb..e447e6ec83 100644 --- a/activerecord/test/cases/adapters/mysql2/transaction_test.rb +++ b/activerecord/test/cases/adapters/mysql2/transaction_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/mysql2/unsigned_type_test.rb b/activerecord/test/cases/adapters/mysql2/unsigned_type_test.rb index 71dcfaa241..1703e8fef7 100644 --- a/activerecord/test/cases/adapters/mysql2/unsigned_type_test.rb +++ b/activerecord/test/cases/adapters/mysql2/unsigned_type_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb b/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb index 442a4fb7b5..85e283bfe1 100644 --- a/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb +++ b/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/active_schema_test.rb b/activerecord/test/cases/adapters/postgresql/active_schema_test.rb index b787de8453..441e84a117 100644 --- a/activerecord/test/cases/adapters/postgresql/active_schema_test.rb +++ b/activerecord/test/cases/adapters/postgresql/active_schema_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class PostgresqlActiveSchemaTest < ActiveRecord::PostgreSQLTestCase diff --git a/activerecord/test/cases/adapters/postgresql/array_test.rb b/activerecord/test/cases/adapters/postgresql/array_test.rb index 121c62dadf..a642145726 100644 --- a/activerecord/test/cases/adapters/postgresql/array_test.rb +++ b/activerecord/test/cases/adapters/postgresql/array_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/bit_string_test.rb b/activerecord/test/cases/adapters/postgresql/bit_string_test.rb index 7712e809a2..d7ed0aa8dd 100644 --- a/activerecord/test/cases/adapters/postgresql/bit_string_test.rb +++ b/activerecord/test/cases/adapters/postgresql/bit_string_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/connection_helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/bytea_test.rb b/activerecord/test/cases/adapters/postgresql/bytea_test.rb index 539c90f0bc..7cb5c2442c 100644 --- a/activerecord/test/cases/adapters/postgresql/bytea_test.rb +++ b/activerecord/test/cases/adapters/postgresql/bytea_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb b/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb index 03b44feab6..b6db6e5e28 100644 --- a/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb +++ b/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class PostgresqlCaseInsensitiveTest < ActiveRecord::PostgreSQLTestCase diff --git a/activerecord/test/cases/adapters/postgresql/change_schema_test.rb b/activerecord/test/cases/adapters/postgresql/change_schema_test.rb index ea642069d2..9d7fddfc02 100644 --- a/activerecord/test/cases/adapters/postgresql/change_schema_test.rb +++ b/activerecord/test/cases/adapters/postgresql/change_schema_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/adapters/postgresql/cidr_test.rb b/activerecord/test/cases/adapters/postgresql/cidr_test.rb index 52f2a0096c..fccd8b3c7b 100644 --- a/activerecord/test/cases/adapters/postgresql/cidr_test.rb +++ b/activerecord/test/cases/adapters/postgresql/cidr_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "ipaddr" diff --git a/activerecord/test/cases/adapters/postgresql/citext_test.rb b/activerecord/test/cases/adapters/postgresql/citext_test.rb index ca95e4b626..ffdd2983c6 100644 --- a/activerecord/test/cases/adapters/postgresql/citext_test.rb +++ b/activerecord/test/cases/adapters/postgresql/citext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/collation_test.rb b/activerecord/test/cases/adapters/postgresql/collation_test.rb index a603221d8f..2929c9ad94 100644 --- a/activerecord/test/cases/adapters/postgresql/collation_test.rb +++ b/activerecord/test/cases/adapters/postgresql/collation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/composite_test.rb b/activerecord/test/cases/adapters/postgresql/composite_test.rb index 1da2a9e2ac..9eb422a8a3 100644 --- a/activerecord/test/cases/adapters/postgresql/composite_test.rb +++ b/activerecord/test/cases/adapters/postgresql/composite_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/postgresql/connection_test.rb b/activerecord/test/cases/adapters/postgresql/connection_test.rb index 32afe331fa..3adae7e146 100644 --- a/activerecord/test/cases/adapters/postgresql/connection_test.rb +++ b/activerecord/test/cases/adapters/postgresql/connection_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/postgresql/datatype_test.rb b/activerecord/test/cases/adapters/postgresql/datatype_test.rb index 0725fde5ae..f947868898 100644 --- a/activerecord/test/cases/adapters/postgresql/datatype_test.rb +++ b/activerecord/test/cases/adapters/postgresql/datatype_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/ddl_helper" diff --git a/activerecord/test/cases/adapters/postgresql/domain_test.rb b/activerecord/test/cases/adapters/postgresql/domain_test.rb index f1eb8adb15..b16e0f9265 100644 --- a/activerecord/test/cases/adapters/postgresql/domain_test.rb +++ b/activerecord/test/cases/adapters/postgresql/domain_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/postgresql/enum_test.rb b/activerecord/test/cases/adapters/postgresql/enum_test.rb index 5e5a3158ba..0f8ab8ab23 100644 --- a/activerecord/test/cases/adapters/postgresql/enum_test.rb +++ b/activerecord/test/cases/adapters/postgresql/enum_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/postgresql/explain_test.rb b/activerecord/test/cases/adapters/postgresql/explain_test.rb index d79fbccf47..8a0cf440fd 100644 --- a/activerecord/test/cases/adapters/postgresql/explain_test.rb +++ b/activerecord/test/cases/adapters/postgresql/explain_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/computer" diff --git a/activerecord/test/cases/adapters/postgresql/extension_migration_test.rb b/activerecord/test/cases/adapters/postgresql/extension_migration_test.rb index b56c226763..ba2b4e1fbf 100644 --- a/activerecord/test/cases/adapters/postgresql/extension_migration_test.rb +++ b/activerecord/test/cases/adapters/postgresql/extension_migration_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class PostgresqlExtensionMigrationTest < ActiveRecord::PostgreSQLTestCase diff --git a/activerecord/test/cases/adapters/postgresql/full_text_test.rb b/activerecord/test/cases/adapters/postgresql/full_text_test.rb index 5ddfe32007..fa8aadd224 100644 --- a/activerecord/test/cases/adapters/postgresql/full_text_test.rb +++ b/activerecord/test/cases/adapters/postgresql/full_text_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/geometric_test.rb b/activerecord/test/cases/adapters/postgresql/geometric_test.rb index 3b6840a1c9..34836b2421 100644 --- a/activerecord/test/cases/adapters/postgresql/geometric_test.rb +++ b/activerecord/test/cases/adapters/postgresql/geometric_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/connection_helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/hstore_test.rb b/activerecord/test/cases/adapters/postgresql/hstore_test.rb index f9cce10fb8..b547868b57 100644 --- a/activerecord/test/cases/adapters/postgresql/hstore_test.rb +++ b/activerecord/test/cases/adapters/postgresql/hstore_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/infinity_test.rb b/activerecord/test/cases/adapters/postgresql/infinity_test.rb index b9e177e6ec..df5c688881 100644 --- a/activerecord/test/cases/adapters/postgresql/infinity_test.rb +++ b/activerecord/test/cases/adapters/postgresql/infinity_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class PostgresqlInfinityTest < ActiveRecord::PostgreSQLTestCase diff --git a/activerecord/test/cases/adapters/postgresql/integer_test.rb b/activerecord/test/cases/adapters/postgresql/integer_test.rb index b4e55964b9..5557e869ad 100644 --- a/activerecord/test/cases/adapters/postgresql/integer_test.rb +++ b/activerecord/test/cases/adapters/postgresql/integer_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "active_support/core_ext/numeric/bytes" diff --git a/activerecord/test/cases/adapters/postgresql/json_test.rb b/activerecord/test/cases/adapters/postgresql/json_test.rb index 6aa60630c2..4438f349cc 100644 --- a/activerecord/test/cases/adapters/postgresql/json_test.rb +++ b/activerecord/test/cases/adapters/postgresql/json_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "cases/json_shared_test_cases" diff --git a/activerecord/test/cases/adapters/postgresql/ltree_test.rb b/activerecord/test/cases/adapters/postgresql/ltree_test.rb index 2b5ac1cac6..447d68316c 100644 --- a/activerecord/test/cases/adapters/postgresql/ltree_test.rb +++ b/activerecord/test/cases/adapters/postgresql/ltree_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/money_test.rb b/activerecord/test/cases/adapters/postgresql/money_test.rb index 1b5d8362af..530aeb0c29 100644 --- a/activerecord/test/cases/adapters/postgresql/money_test.rb +++ b/activerecord/test/cases/adapters/postgresql/money_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/network_test.rb b/activerecord/test/cases/adapters/postgresql/network_test.rb index a33b0ef8a7..2bbfb292c4 100644 --- a/activerecord/test/cases/adapters/postgresql/network_test.rb +++ b/activerecord/test/cases/adapters/postgresql/network_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/numbers_test.rb b/activerecord/test/cases/adapters/postgresql/numbers_test.rb index bfb2b7c27a..82edf7db3f 100644 --- a/activerecord/test/cases/adapters/postgresql/numbers_test.rb +++ b/activerecord/test/cases/adapters/postgresql/numbers_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class PostgresqlNumberTest < ActiveRecord::PostgreSQLTestCase diff --git a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb index 76e0ad60fe..7c7bb0a942 100644 --- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb +++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/ddl_helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb b/activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb index 8c62690866..0120e33f70 100644 --- a/activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb +++ b/activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/computer" require "models/developer" diff --git a/activerecord/test/cases/adapters/postgresql/quoting_test.rb b/activerecord/test/cases/adapters/postgresql/quoting_test.rb index a1e966b915..1205559558 100644 --- a/activerecord/test/cases/adapters/postgresql/quoting_test.rb +++ b/activerecord/test/cases/adapters/postgresql/quoting_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/adapters/postgresql/range_test.rb b/activerecord/test/cases/adapters/postgresql/range_test.rb index f411884dfd..8de162a8a1 100644 --- a/activerecord/test/cases/adapters/postgresql/range_test.rb +++ b/activerecord/test/cases/adapters/postgresql/range_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb b/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb index 0ff04bfa27..0b17c141c8 100644 --- a/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb +++ b/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/postgresql/rename_table_test.rb b/activerecord/test/cases/adapters/postgresql/rename_table_test.rb index e9e7f717ac..5b253999d5 100644 --- a/activerecord/test/cases/adapters/postgresql/rename_table_test.rb +++ b/activerecord/test/cases/adapters/postgresql/rename_table_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class PostgresqlRenameTableTest < ActiveRecord::PostgreSQLTestCase diff --git a/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb b/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb index f86a76e08a..db7d8ba751 100644 --- a/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb +++ b/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class SchemaThing < ActiveRecord::Base diff --git a/activerecord/test/cases/adapters/postgresql/schema_test.rb b/activerecord/test/cases/adapters/postgresql/schema_test.rb index f6b957476b..5438665d42 100644 --- a/activerecord/test/cases/adapters/postgresql/schema_test.rb +++ b/activerecord/test/cases/adapters/postgresql/schema_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/default" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/serial_test.rb b/activerecord/test/cases/adapters/postgresql/serial_test.rb index d711b3b729..4930d3f67a 100644 --- a/activerecord/test/cases/adapters/postgresql/serial_test.rb +++ b/activerecord/test/cases/adapters/postgresql/serial_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb b/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb index 146b619a4b..73cf91425b 100644 --- a/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb +++ b/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/adapters/postgresql/timestamp_test.rb b/activerecord/test/cases/adapters/postgresql/timestamp_test.rb index 962450aada..c7dec25f3a 100644 --- a/activerecord/test/cases/adapters/postgresql/timestamp_test.rb +++ b/activerecord/test/cases/adapters/postgresql/timestamp_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/topic" diff --git a/activerecord/test/cases/adapters/postgresql/transaction_test.rb b/activerecord/test/cases/adapters/postgresql/transaction_test.rb index 9b42d0383d..c1b19c11f5 100644 --- a/activerecord/test/cases/adapters/postgresql/transaction_test.rb +++ b/activerecord/test/cases/adapters/postgresql/transaction_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/connection_helper" require "concurrent/atomic/cyclic_barrier" diff --git a/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb b/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb index 784d77a8d1..688117722b 100644 --- a/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb +++ b/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class PostgresqlTypeLookupTest < ActiveRecord::PostgreSQLTestCase diff --git a/activerecord/test/cases/adapters/postgresql/utils_test.rb b/activerecord/test/cases/adapters/postgresql/utils_test.rb index 9f9e3bda2f..1a655d7843 100644 --- a/activerecord/test/cases/adapters/postgresql/utils_test.rb +++ b/activerecord/test/cases/adapters/postgresql/utils_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "active_record/connection_adapters/postgresql/utils" diff --git a/activerecord/test/cases/adapters/postgresql/uuid_test.rb b/activerecord/test/cases/adapters/postgresql/uuid_test.rb index 8eddd81c38..49c570c917 100644 --- a/activerecord/test/cases/adapters/postgresql/uuid_test.rb +++ b/activerecord/test/cases/adapters/postgresql/uuid_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/xml_test.rb b/activerecord/test/cases/adapters/postgresql/xml_test.rb index 826b384fb3..b0720b5a6e 100644 --- a/activerecord/test/cases/adapters/postgresql/xml_test.rb +++ b/activerecord/test/cases/adapters/postgresql/xml_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/sqlite3/collation_test.rb b/activerecord/test/cases/adapters/sqlite3/collation_test.rb index dd88ed3656..f3cbb408f1 100644 --- a/activerecord/test/cases/adapters/sqlite3/collation_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/collation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb b/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb index e1cfd703e8..cc1f74ed41 100644 --- a/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class CopyTableTest < ActiveRecord::SQLite3TestCase diff --git a/activerecord/test/cases/adapters/sqlite3/explain_test.rb b/activerecord/test/cases/adapters/sqlite3/explain_test.rb index 29d97ae78c..a3f6299756 100644 --- a/activerecord/test/cases/adapters/sqlite3/explain_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/explain_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/computer" diff --git a/activerecord/test/cases/adapters/sqlite3/quoting_test.rb b/activerecord/test/cases/adapters/sqlite3/quoting_test.rb index aefbb309e6..0a5bf7754c 100644 --- a/activerecord/test/cases/adapters/sqlite3/quoting_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/quoting_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "bigdecimal" require "securerandom" diff --git a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb index 9a812e325e..7adba54836 100644 --- a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/owner" require "tempfile" diff --git a/activerecord/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb b/activerecord/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb index b1b4463bf1..d23a7ac532 100644 --- a/activerecord/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/owner" diff --git a/activerecord/test/cases/adapters/sqlite3/statement_pool_test.rb b/activerecord/test/cases/adapters/sqlite3/statement_pool_test.rb index 37ff973397..76841c235a 100644 --- a/activerecord/test/cases/adapters/sqlite3/statement_pool_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/statement_pool_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class SQLite3StatementPoolTest < ActiveRecord::SQLite3TestCase diff --git a/activerecord/test/cases/aggregations_test.rb b/activerecord/test/cases/aggregations_test.rb index f8136fde72..97be9c447a 100644 --- a/activerecord/test/cases/aggregations_test.rb +++ b/activerecord/test/cases/aggregations_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/customer" diff --git a/activerecord/test/cases/ar_schema_test.rb b/activerecord/test/cases/ar_schema_test.rb index 5b608d8e83..aaae3736a9 100644 --- a/activerecord/test/cases/ar_schema_test.rb +++ b/activerecord/test/cases/ar_schema_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class ActiveRecordSchemaTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/associations/association_scope_test.rb b/activerecord/test/cases/associations/association_scope_test.rb index c54542ff7b..a57eb78a14 100644 --- a/activerecord/test/cases/associations/association_scope_test.rb +++ b/activerecord/test/cases/associations/association_scope_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/author" diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index a727cc6e60..af3f40974d 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/project" diff --git a/activerecord/test/cases/associations/bidirectional_destroy_dependencies_test.rb b/activerecord/test/cases/associations/bidirectional_destroy_dependencies_test.rb index 8a0e041864..eee327a0bc 100644 --- a/activerecord/test/cases/associations/bidirectional_destroy_dependencies_test.rb +++ b/activerecord/test/cases/associations/bidirectional_destroy_dependencies_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/content" diff --git a/activerecord/test/cases/associations/callbacks_test.rb b/activerecord/test/cases/associations/callbacks_test.rb index f9d1e44595..b91fb5b7ed 100644 --- a/activerecord/test/cases/associations/callbacks_test.rb +++ b/activerecord/test/cases/associations/callbacks_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/author" diff --git a/activerecord/test/cases/associations/cascaded_eager_loading_test.rb b/activerecord/test/cases/associations/cascaded_eager_loading_test.rb index 7b0445025c..ea2582b507 100644 --- a/activerecord/test/cases/associations/cascaded_eager_loading_test.rb +++ b/activerecord/test/cases/associations/cascaded_eager_loading_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb b/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb index 61f39b4136..f6de62b1af 100644 --- a/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb +++ b/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/tagging" diff --git a/activerecord/test/cases/associations/eager_load_nested_include_test.rb b/activerecord/test/cases/associations/eager_load_nested_include_test.rb index e9f551b6b2..83c85cd022 100644 --- a/activerecord/test/cases/associations/eager_load_nested_include_test.rb +++ b/activerecord/test/cases/associations/eager_load_nested_include_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/tag" diff --git a/activerecord/test/cases/associations/eager_singularization_test.rb b/activerecord/test/cases/associations/eager_singularization_test.rb index 16eff15026..860bb9ac54 100644 --- a/activerecord/test/cases/associations/eager_singularization_test.rb +++ b/activerecord/test/cases/associations/eager_singularization_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class EagerSingularizationTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index 55b294cfaa..e0b137304b 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/tagging" diff --git a/activerecord/test/cases/associations/extension_test.rb b/activerecord/test/cases/associations/extension_test.rb index f707a170f5..d2f21583a7 100644 --- a/activerecord/test/cases/associations/extension_test.rb +++ b/activerecord/test/cases/associations/extension_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb index f73005b3cb..fa40bd2ff8 100644 --- a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/computer" diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index a936017ae3..07354a2379 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/computer" diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb index 1c2138a3d0..6794428688 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/person" diff --git a/activerecord/test/cases/associations/has_one_associations_test.rb b/activerecord/test/cases/associations/has_one_associations_test.rb index bf3b8dcd63..545eec7e5d 100644 --- a/activerecord/test/cases/associations/has_one_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_associations_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/computer" diff --git a/activerecord/test/cases/associations/has_one_through_associations_test.rb b/activerecord/test/cases/associations/has_one_through_associations_test.rb index 28b883586d..0a74a9e710 100644 --- a/activerecord/test/cases/associations/has_one_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_through_associations_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/club" require "models/member_type" diff --git a/activerecord/test/cases/associations/inner_join_association_test.rb b/activerecord/test/cases/associations/inner_join_association_test.rb index ddf5bc6f0b..6fff4171c8 100644 --- a/activerecord/test/cases/associations/inner_join_association_test.rb +++ b/activerecord/test/cases/associations/inner_join_association_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/associations/inverse_associations_test.rb b/activerecord/test/cases/associations/inverse_associations_test.rb index 467cc73ecd..d8f7d3b21c 100644 --- a/activerecord/test/cases/associations/inverse_associations_test.rb +++ b/activerecord/test/cases/associations/inverse_associations_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/man" require "models/face" diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb index c078cef064..c2758b30a1 100644 --- a/activerecord/test/cases/associations/join_model_test.rb +++ b/activerecord/test/cases/associations/join_model_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/tag" require "models/tagging" diff --git a/activerecord/test/cases/associations/left_outer_join_association_test.rb b/activerecord/test/cases/associations/left_outer_join_association_test.rb index 6d3757f467..68c9286972 100644 --- a/activerecord/test/cases/associations/left_outer_join_association_test.rb +++ b/activerecord/test/cases/associations/left_outer_join_association_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/associations/nested_through_associations_test.rb b/activerecord/test/cases/associations/nested_through_associations_test.rb index 67ff7355b3..90b2d4bc07 100644 --- a/activerecord/test/cases/associations/nested_through_associations_test.rb +++ b/activerecord/test/cases/associations/nested_through_associations_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/author" require "models/post" diff --git a/activerecord/test/cases/associations/required_test.rb b/activerecord/test/cases/associations/required_test.rb index 45e1803858..6cf2d8ac12 100644 --- a/activerecord/test/cases/associations/required_test.rb +++ b/activerecord/test/cases/associations/required_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class RequiredAssociationsTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb index 2eb31326a5..ba2f4c11c8 100644 --- a/activerecord/test/cases/associations_test.rb +++ b/activerecord/test/cases/associations_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/computer" require "models/developer" diff --git a/activerecord/test/cases/attribute_decorators_test.rb b/activerecord/test/cases/attribute_decorators_test.rb index cfa6ed1da6..eb8efab6a5 100644 --- a/activerecord/test/cases/attribute_decorators_test.rb +++ b/activerecord/test/cases/attribute_decorators_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/attribute_methods/read_test.rb b/activerecord/test/cases/attribute_methods/read_test.rb index 1fc63a49d4..a366144e17 100644 --- a/activerecord/test/cases/attribute_methods/read_test.rb +++ b/activerecord/test/cases/attribute_methods/read_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index 4d24a980dc..1f3a3652d7 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/minimalistic" require "models/developer" diff --git a/activerecord/test/cases/attribute_set_test.rb b/activerecord/test/cases/attribute_set_test.rb index bd4b200735..80c67f171b 100644 --- a/activerecord/test/cases/attribute_set_test.rb +++ b/activerecord/test/cases/attribute_set_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/attribute_test.rb b/activerecord/test/cases/attribute_test.rb index 7cf6b498c9..0271ed5fb9 100644 --- a/activerecord/test/cases/attribute_test.rb +++ b/activerecord/test/cases/attribute_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/attributes_test.rb b/activerecord/test/cases/attributes_test.rb index 3705a6be89..8aa515fe6e 100644 --- a/activerecord/test/cases/attributes_test.rb +++ b/activerecord/test/cases/attributes_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class OverloadedType < ActiveRecord::Base diff --git a/activerecord/test/cases/autosave_association_test.rb b/activerecord/test/cases/autosave_association_test.rb index 2203aa1788..db2a19ea62 100644 --- a/activerecord/test/cases/autosave_association_test.rb +++ b/activerecord/test/cases/autosave_association_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/bird" require "models/post" diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index dc32e995a4..a26a4bbb61 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/author" diff --git a/activerecord/test/cases/batches_test.rb b/activerecord/test/cases/batches_test.rb index fbc3fbb44f..1f666a5d39 100644 --- a/activerecord/test/cases/batches_test.rb +++ b/activerecord/test/cases/batches_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/subscriber" diff --git a/activerecord/test/cases/binary_test.rb b/activerecord/test/cases/binary_test.rb index 1fc30e24d2..324a74492c 100644 --- a/activerecord/test/cases/binary_test.rb +++ b/activerecord/test/cases/binary_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" # Without using prepared statements, it makes no sense to test diff --git a/activerecord/test/cases/bind_parameter_test.rb b/activerecord/test/cases/bind_parameter_test.rb index 5af44c27eb..8504f586cc 100644 --- a/activerecord/test/cases/bind_parameter_test.rb +++ b/activerecord/test/cases/bind_parameter_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/author" diff --git a/activerecord/test/cases/cache_key_test.rb b/activerecord/test/cases/cache_key_test.rb index 7b8264e6e8..f0a1bb9e22 100644 --- a/activerecord/test/cases/cache_key_test.rb +++ b/activerecord/test/cases/cache_key_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index 80baaac30a..478b9fe742 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/book" require "models/club" diff --git a/activerecord/test/cases/callbacks_test.rb b/activerecord/test/cases/callbacks_test.rb index b3c86586d0..55deaa6947 100644 --- a/activerecord/test/cases/callbacks_test.rb +++ b/activerecord/test/cases/callbacks_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/computer" diff --git a/activerecord/test/cases/clone_test.rb b/activerecord/test/cases/clone_test.rb index b89294c094..fa0f53676e 100644 --- a/activerecord/test/cases/clone_test.rb +++ b/activerecord/test/cases/clone_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" diff --git a/activerecord/test/cases/coders/json_test.rb b/activerecord/test/cases/coders/json_test.rb index d22d93d129..95e6fb3e7b 100644 --- a/activerecord/test/cases/coders/json_test.rb +++ b/activerecord/test/cases/coders/json_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/coders/yaml_column_test.rb b/activerecord/test/cases/coders/yaml_column_test.rb index a26a72712d..e3e85a58a4 100644 --- a/activerecord/test/cases/coders/yaml_column_test.rb +++ b/activerecord/test/cases/coders/yaml_column_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/collection_cache_key_test.rb b/activerecord/test/cases/collection_cache_key_test.rb index f344c77691..2d10a68416 100644 --- a/activerecord/test/cases/collection_cache_key_test.rb +++ b/activerecord/test/cases/collection_cache_key_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/computer" require "models/developer" diff --git a/activerecord/test/cases/column_alias_test.rb b/activerecord/test/cases/column_alias_test.rb index 9893ba9580..506ae05756 100644 --- a/activerecord/test/cases/column_alias_test.rb +++ b/activerecord/test/cases/column_alias_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" diff --git a/activerecord/test/cases/column_definition_test.rb b/activerecord/test/cases/column_definition_test.rb index 90c8d21c43..fcb0952c1c 100644 --- a/activerecord/test/cases/column_definition_test.rb +++ b/activerecord/test/cases/column_definition_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/comment_test.rb b/activerecord/test/cases/comment_test.rb index c23be52a6c..5c91ac347c 100644 --- a/activerecord/test/cases/comment_test.rb +++ b/activerecord/test/cases/comment_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/connection_adapters/adapter_leasing_test.rb b/activerecord/test/cases/connection_adapters/adapter_leasing_test.rb index 64189381cb..4f88b129af 100644 --- a/activerecord/test/cases/connection_adapters/adapter_leasing_test.rb +++ b/activerecord/test/cases/connection_adapters/adapter_leasing_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/connection_adapters/connection_handler_test.rb b/activerecord/test/cases/connection_adapters/connection_handler_test.rb index 2a71f08d90..f8725ddb01 100644 --- a/activerecord/test/cases/connection_adapters/connection_handler_test.rb +++ b/activerecord/test/cases/connection_adapters/connection_handler_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/connection_adapters/connection_specification_test.rb b/activerecord/test/cases/connection_adapters/connection_specification_test.rb index 10a3521c79..40998c06bf 100644 --- a/activerecord/test/cases/connection_adapters/connection_specification_test.rb +++ b/activerecord/test/cases/connection_adapters/connection_specification_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb b/activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb index 8faa67255d..7c98c80e39 100644 --- a/activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb +++ b/activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb b/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb index 3657b8340d..133632bac9 100644 --- a/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb +++ b/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" if current_adapter?(:Mysql2Adapter) diff --git a/activerecord/test/cases/connection_adapters/schema_cache_test.rb b/activerecord/test/cases/connection_adapters/schema_cache_test.rb index 106323ccc9..3370818616 100644 --- a/activerecord/test/cases/connection_adapters/schema_cache_test.rb +++ b/activerecord/test/cases/connection_adapters/schema_cache_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/connection_adapters/type_lookup_test.rb b/activerecord/test/cases/connection_adapters/type_lookup_test.rb index a348c2d783..251483da44 100644 --- a/activerecord/test/cases/connection_adapters/type_lookup_test.rb +++ b/activerecord/test/cases/connection_adapters/type_lookup_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" unless current_adapter?(:PostgreSQLAdapter) # PostgreSQL does not use type strings for lookup diff --git a/activerecord/test/cases/connection_management_test.rb b/activerecord/test/cases/connection_management_test.rb index d1e946d401..9bd0aab981 100644 --- a/activerecord/test/cases/connection_management_test.rb +++ b/activerecord/test/cases/connection_management_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "rack" diff --git a/activerecord/test/cases/connection_pool_test.rb b/activerecord/test/cases/connection_pool_test.rb index 00a0187b57..adbd158e7a 100644 --- a/activerecord/test/cases/connection_pool_test.rb +++ b/activerecord/test/cases/connection_pool_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "concurrent/atomic/count_down_latch" diff --git a/activerecord/test/cases/connection_specification/resolver_test.rb b/activerecord/test/cases/connection_specification/resolver_test.rb index 13b5bae13c..3d97281627 100644 --- a/activerecord/test/cases/connection_specification/resolver_test.rb +++ b/activerecord/test/cases/connection_specification/resolver_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/core_test.rb b/activerecord/test/cases/core_test.rb index 3735572898..0345608191 100644 --- a/activerecord/test/cases/core_test.rb +++ b/activerecord/test/cases/core_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/person" require "models/topic" diff --git a/activerecord/test/cases/counter_cache_test.rb b/activerecord/test/cases/counter_cache_test.rb index 46d7526cc0..14800e6b91 100644 --- a/activerecord/test/cases/counter_cache_test.rb +++ b/activerecord/test/cases/counter_cache_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/car" diff --git a/activerecord/test/cases/custom_locking_test.rb b/activerecord/test/cases/custom_locking_test.rb index 15c8b684e4..e170843952 100644 --- a/activerecord/test/cases/custom_locking_test.rb +++ b/activerecord/test/cases/custom_locking_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/person" diff --git a/activerecord/test/cases/database_statements_test.rb b/activerecord/test/cases/database_statements_test.rb index 66035865be..5df028d397 100644 --- a/activerecord/test/cases/database_statements_test.rb +++ b/activerecord/test/cases/database_statements_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class DatabaseStatementsTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/date_test.rb b/activerecord/test/cases/date_test.rb index 2edc0415cd..202100ff69 100644 --- a/activerecord/test/cases/date_test.rb +++ b/activerecord/test/cases/date_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" diff --git a/activerecord/test/cases/date_time_precision_test.rb b/activerecord/test/cases/date_time_precision_test.rb index e4a2f9ee17..12b1858991 100644 --- a/activerecord/test/cases/date_time_precision_test.rb +++ b/activerecord/test/cases/date_time_precision_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/date_time_test.rb b/activerecord/test/cases/date_time_test.rb index ad7da9de70..8753c95641 100644 --- a/activerecord/test/cases/date_time_test.rb +++ b/activerecord/test/cases/date_time_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/task" diff --git a/activerecord/test/cases/defaults_test.rb b/activerecord/test/cases/defaults_test.rb index 996d298689..30cfa0744f 100644 --- a/activerecord/test/cases/defaults_test.rb +++ b/activerecord/test/cases/defaults_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" require "models/default" diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb index f72e0d2ead..cc2724502b 100644 --- a/activerecord/test/cases/dirty_test.rb +++ b/activerecord/test/cases/dirty_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" # For booleans require "models/pirate" # For timestamps diff --git a/activerecord/test/cases/disconnected_test.rb b/activerecord/test/cases/disconnected_test.rb index c25089a420..92365351b1 100644 --- a/activerecord/test/cases/disconnected_test.rb +++ b/activerecord/test/cases/disconnected_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class TestRecord < ActiveRecord::Base diff --git a/activerecord/test/cases/dup_test.rb b/activerecord/test/cases/dup_test.rb index 000ed27efb..76979dc798 100644 --- a/activerecord/test/cases/dup_test.rb +++ b/activerecord/test/cases/dup_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/reply" require "models/topic" diff --git a/activerecord/test/cases/enum_test.rb b/activerecord/test/cases/enum_test.rb index 4ef9a125e6..8e13582f3e 100644 --- a/activerecord/test/cases/enum_test.rb +++ b/activerecord/test/cases/enum_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/author" require "models/book" diff --git a/activerecord/test/cases/errors_test.rb b/activerecord/test/cases/errors_test.rb index e90669e0c7..45e28c4f03 100644 --- a/activerecord/test/cases/errors_test.rb +++ b/activerecord/test/cases/errors_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class ErrorsTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/explain_subscriber_test.rb b/activerecord/test/cases/explain_subscriber_test.rb index ca87e04012..0fb6bf2eed 100644 --- a/activerecord/test/cases/explain_subscriber_test.rb +++ b/activerecord/test/cases/explain_subscriber_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "active_record/explain_subscriber" require "active_record/explain_registry" diff --git a/activerecord/test/cases/explain_test.rb b/activerecord/test/cases/explain_test.rb index 4f6bd9327c..de3ec36667 100644 --- a/activerecord/test/cases/explain_test.rb +++ b/activerecord/test/cases/explain_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/car" require "active_support/core_ext/string/strip" diff --git a/activerecord/test/cases/finder_respond_to_test.rb b/activerecord/test/cases/finder_respond_to_test.rb index 3eaa993d45..29d7dee343 100644 --- a/activerecord/test/cases/finder_respond_to_test.rb +++ b/activerecord/test/cases/finder_respond_to_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index 420f552ef6..752ac519a4 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/author" diff --git a/activerecord/test/cases/fixture_set/file_test.rb b/activerecord/test/cases/fixture_set/file_test.rb index 533edcc2e0..c7058133b2 100644 --- a/activerecord/test/cases/fixture_set/file_test.rb +++ b/activerecord/test/cases/fixture_set/file_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "tempfile" diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb index b499e60922..91d0908450 100644 --- a/activerecord/test/cases/fixtures_test.rb +++ b/activerecord/test/cases/fixtures_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/admin" require "models/admin/account" diff --git a/activerecord/test/cases/forbidden_attributes_protection_test.rb b/activerecord/test/cases/forbidden_attributes_protection_test.rb index ffa3f63e0d..d11ec08dea 100644 --- a/activerecord/test/cases/forbidden_attributes_protection_test.rb +++ b/activerecord/test/cases/forbidden_attributes_protection_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "active_support/core_ext/hash/indifferent_access" diff --git a/activerecord/test/cases/habtm_destroy_order_test.rb b/activerecord/test/cases/habtm_destroy_order_test.rb index 365d4576dd..124e3216d0 100644 --- a/activerecord/test/cases/habtm_destroy_order_test.rb +++ b/activerecord/test/cases/habtm_destroy_order_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/lesson" require "models/student" diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 5a3b8e3fb5..84a784e6d5 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "config" require "stringio" diff --git a/activerecord/test/cases/hot_compatibility_test.rb b/activerecord/test/cases/hot_compatibility_test.rb index e107ff2362..970ccc3601 100644 --- a/activerecord/test/cases/hot_compatibility_test.rb +++ b/activerecord/test/cases/hot_compatibility_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/i18n_test.rb b/activerecord/test/cases/i18n_test.rb index 7f03c5b23d..94b5e4ef2f 100644 --- a/activerecord/test/cases/i18n_test.rb +++ b/activerecord/test/cases/i18n_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb index fb5a7bcc31..e73d9d0a27 100644 --- a/activerecord/test/cases/inheritance_test.rb +++ b/activerecord/test/cases/inheritance_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/author" require "models/company" diff --git a/activerecord/test/cases/integration_test.rb b/activerecord/test/cases/integration_test.rb index 9104976126..1075366fb1 100644 --- a/activerecord/test/cases/integration_test.rb +++ b/activerecord/test/cases/integration_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/company" require "models/developer" diff --git a/activerecord/test/cases/invalid_connection_test.rb b/activerecord/test/cases/invalid_connection_test.rb index 1367af2859..256ad59407 100644 --- a/activerecord/test/cases/invalid_connection_test.rb +++ b/activerecord/test/cases/invalid_connection_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" if current_adapter?(:Mysql2Adapter) diff --git a/activerecord/test/cases/invertible_migration_test.rb b/activerecord/test/cases/invertible_migration_test.rb index cc3951e2ba..a44a351209 100644 --- a/activerecord/test/cases/invertible_migration_test.rb +++ b/activerecord/test/cases/invertible_migration_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class Horse < ActiveRecord::Base diff --git a/activerecord/test/cases/json_attribute_test.rb b/activerecord/test/cases/json_attribute_test.rb index e5848b45f8..c64e2c31de 100644 --- a/activerecord/test/cases/json_attribute_test.rb +++ b/activerecord/test/cases/json_attribute_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "cases/json_shared_test_cases" diff --git a/activerecord/test/cases/json_serialization_test.rb b/activerecord/test/cases/json_serialization_test.rb index 9b4b61b16e..2ca95fe3b4 100644 --- a/activerecord/test/cases/json_serialization_test.rb +++ b/activerecord/test/cases/json_serialization_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/contact" require "models/post" diff --git a/activerecord/test/cases/json_shared_test_cases.rb b/activerecord/test/cases/json_shared_test_cases.rb index 9a1c1c3f3f..1eeefb78dd 100644 --- a/activerecord/test/cases/json_shared_test_cases.rb +++ b/activerecord/test/cases/json_shared_test_cases.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "support/schema_dumping_helper" module JSONSharedTestCases diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb index 2fc52393f2..e67ec22c42 100644 --- a/activerecord/test/cases/locking_test.rb +++ b/activerecord/test/cases/locking_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "thread" require "cases/helper" require "models/person" diff --git a/activerecord/test/cases/log_subscriber_test.rb b/activerecord/test/cases/log_subscriber_test.rb index b80257962c..0eaca0d001 100644 --- a/activerecord/test/cases/log_subscriber_test.rb +++ b/activerecord/test/cases/log_subscriber_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/binary" require "models/developer" diff --git a/activerecord/test/cases/migration/change_schema_test.rb b/activerecord/test/cases/migration/change_schema_test.rb index 1d305fa11f..e706fc4f08 100644 --- a/activerecord/test/cases/migration/change_schema_test.rb +++ b/activerecord/test/cases/migration/change_schema_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/change_table_test.rb b/activerecord/test/cases/migration/change_table_test.rb index ec817a579b..f1ca91887b 100644 --- a/activerecord/test/cases/migration/change_table_test.rb +++ b/activerecord/test/cases/migration/change_table_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/migration/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/column_attributes_test.rb b/activerecord/test/cases/migration/column_attributes_test.rb index 48df931543..5ef0847a64 100644 --- a/activerecord/test/cases/migration/column_attributes_test.rb +++ b/activerecord/test/cases/migration/column_attributes_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/migration/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/column_positioning_test.rb b/activerecord/test/cases/migration/column_positioning_test.rb index f2162d91b1..bdbad431e8 100644 --- a/activerecord/test/cases/migration/column_positioning_test.rb +++ b/activerecord/test/cases/migration/column_positioning_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/columns_test.rb b/activerecord/test/cases/migration/columns_test.rb index 2329888345..c4751277f7 100644 --- a/activerecord/test/cases/migration/columns_test.rb +++ b/activerecord/test/cases/migration/columns_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/migration/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/command_recorder_test.rb b/activerecord/test/cases/migration/command_recorder_test.rb index 007926f1b9..be200a7225 100644 --- a/activerecord/test/cases/migration/command_recorder_test.rb +++ b/activerecord/test/cases/migration/command_recorder_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/compatibility_test.rb b/activerecord/test/cases/migration/compatibility_test.rb index 596a21dcbc..4321f967d2 100644 --- a/activerecord/test/cases/migration/compatibility_test.rb +++ b/activerecord/test/cases/migration/compatibility_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/migration/create_join_table_test.rb b/activerecord/test/cases/migration/create_join_table_test.rb index c4896f3d6e..0e9e880fe1 100644 --- a/activerecord/test/cases/migration/create_join_table_test.rb +++ b/activerecord/test/cases/migration/create_join_table_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/foreign_key_test.rb b/activerecord/test/cases/migration/foreign_key_test.rb index 7762d37915..7a44b2db75 100644 --- a/activerecord/test/cases/migration/foreign_key_test.rb +++ b/activerecord/test/cases/migration/foreign_key_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/migration/helper.rb b/activerecord/test/cases/migration/helper.rb index 9c0fa7339d..e366ed92b1 100644 --- a/activerecord/test/cases/migration/helper.rb +++ b/activerecord/test/cases/migration/helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/index_test.rb b/activerecord/test/cases/migration/index_test.rb index f10fcf1398..ccc0f4948f 100644 --- a/activerecord/test/cases/migration/index_test.rb +++ b/activerecord/test/cases/migration/index_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/logger_test.rb b/activerecord/test/cases/migration/logger_test.rb index 3d7c7ad469..9fe64b73a8 100644 --- a/activerecord/test/cases/migration/logger_test.rb +++ b/activerecord/test/cases/migration/logger_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/pending_migrations_test.rb b/activerecord/test/cases/migration/pending_migrations_test.rb index 6970fdcc87..0cb4b6cfa1 100644 --- a/activerecord/test/cases/migration/pending_migrations_test.rb +++ b/activerecord/test/cases/migration/pending_migrations_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/references_foreign_key_test.rb b/activerecord/test/cases/migration/references_foreign_key_test.rb index 718b9a0613..405fd7aaed 100644 --- a/activerecord/test/cases/migration/references_foreign_key_test.rb +++ b/activerecord/test/cases/migration/references_foreign_key_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" if ActiveRecord::Base.connection.supports_foreign_keys_in_create? diff --git a/activerecord/test/cases/migration/references_index_test.rb b/activerecord/test/cases/migration/references_index_test.rb index 2866cabab6..2954f1e275 100644 --- a/activerecord/test/cases/migration/references_index_test.rb +++ b/activerecord/test/cases/migration/references_index_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/references_statements_test.rb b/activerecord/test/cases/migration/references_statements_test.rb index e9eb9968cb..f8b373bdee 100644 --- a/activerecord/test/cases/migration/references_statements_test.rb +++ b/activerecord/test/cases/migration/references_statements_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/migration/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/rename_table_test.rb b/activerecord/test/cases/migration/rename_table_test.rb index 5da3ad33a3..bee528ca8a 100644 --- a/activerecord/test/cases/migration/rename_table_test.rb +++ b/activerecord/test/cases/migration/rename_table_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/migration/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index 3a49a41580..315e58668a 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "cases/migration/helper" require "bigdecimal/util" diff --git a/activerecord/test/cases/migrator_test.rb b/activerecord/test/cases/migrator_test.rb index 2e4b454a86..b93643922d 100644 --- a/activerecord/test/cases/migrator_test.rb +++ b/activerecord/test/cases/migrator_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "cases/migration/helper" diff --git a/activerecord/test/cases/mixin_test.rb b/activerecord/test/cases/mixin_test.rb index a8af8e30f7..82190c283e 100644 --- a/activerecord/test/cases/mixin_test.rb +++ b/activerecord/test/cases/mixin_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class Mixin < ActiveRecord::Base diff --git a/activerecord/test/cases/modules_test.rb b/activerecord/test/cases/modules_test.rb index f8a7bab35f..514911cb13 100644 --- a/activerecord/test/cases/modules_test.rb +++ b/activerecord/test/cases/modules_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/company_in_module" require "models/shop" diff --git a/activerecord/test/cases/multiparameter_attributes_test.rb b/activerecord/test/cases/multiparameter_attributes_test.rb index ceb5724377..7a35b5dc84 100644 --- a/activerecord/test/cases/multiparameter_attributes_test.rb +++ b/activerecord/test/cases/multiparameter_attributes_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/customer" diff --git a/activerecord/test/cases/multiple_db_test.rb b/activerecord/test/cases/multiple_db_test.rb index e3bb51bd77..bfa5da765b 100644 --- a/activerecord/test/cases/multiple_db_test.rb +++ b/activerecord/test/cases/multiple_db_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/entrant" require "models/bird" diff --git a/activerecord/test/cases/nested_attributes_test.rb b/activerecord/test/cases/nested_attributes_test.rb index 154faa56aa..aea65a7baf 100644 --- a/activerecord/test/cases/nested_attributes_test.rb +++ b/activerecord/test/cases/nested_attributes_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/pirate" require "models/ship" diff --git a/activerecord/test/cases/nested_attributes_with_callbacks_test.rb b/activerecord/test/cases/nested_attributes_with_callbacks_test.rb index b9d2acbed2..905ddef063 100644 --- a/activerecord/test/cases/nested_attributes_with_callbacks_test.rb +++ b/activerecord/test/cases/nested_attributes_with_callbacks_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/pirate" require "models/bird" diff --git a/activerecord/test/cases/numeric_data_test.rb b/activerecord/test/cases/numeric_data_test.rb index 76b97033af..b0a3d566bb 100644 --- a/activerecord/test/cases/numeric_data_test.rb +++ b/activerecord/test/cases/numeric_data_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/numeric_data" diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb index 5895c51714..8f0099ee48 100644 --- a/activerecord/test/cases/persistence_test.rb +++ b/activerecord/test/cases/persistence_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/aircraft" require "models/post" diff --git a/activerecord/test/cases/pooled_connections_test.rb b/activerecord/test/cases/pooled_connections_test.rb index f1b0d08765..d99318f1aa 100644 --- a/activerecord/test/cases/pooled_connections_test.rb +++ b/activerecord/test/cases/pooled_connections_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/project" require "timeout" diff --git a/activerecord/test/cases/primary_keys_test.rb b/activerecord/test/cases/primary_keys_test.rb index 56229b70bc..61cd6b45a1 100644 --- a/activerecord/test/cases/primary_keys_test.rb +++ b/activerecord/test/cases/primary_keys_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" require "models/topic" diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb index b018a7b6c0..fb5305d288 100644 --- a/activerecord/test/cases/query_cache_test.rb +++ b/activerecord/test/cases/query_cache_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/task" diff --git a/activerecord/test/cases/quoting_test.rb b/activerecord/test/cases/quoting_test.rb index 0819776fbf..4cfad9c21f 100644 --- a/activerecord/test/cases/quoting_test.rb +++ b/activerecord/test/cases/quoting_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/readonly_test.rb b/activerecord/test/cases/readonly_test.rb index 24b678310d..2e8d108985 100644 --- a/activerecord/test/cases/readonly_test.rb +++ b/activerecord/test/cases/readonly_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/author" require "models/post" diff --git a/activerecord/test/cases/reaper_test.rb b/activerecord/test/cases/reaper_test.rb index 249878b67d..153311bece 100644 --- a/activerecord/test/cases/reaper_test.rb +++ b/activerecord/test/cases/reaper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/reflection_test.rb b/activerecord/test/cases/reflection_test.rb index c1c2efb9c8..e27000472c 100644 --- a/activerecord/test/cases/reflection_test.rb +++ b/activerecord/test/cases/reflection_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/customer" diff --git a/activerecord/test/cases/relation/delegation_test.rb b/activerecord/test/cases/relation/delegation_test.rb index 3b15f051b2..5945eab75a 100644 --- a/activerecord/test/cases/relation/delegation_test.rb +++ b/activerecord/test/cases/relation/delegation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/relation/merging_test.rb b/activerecord/test/cases/relation/merging_test.rb index 3901824aac..feb5604284 100644 --- a/activerecord/test/cases/relation/merging_test.rb +++ b/activerecord/test/cases/relation/merging_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/author" require "models/comment" diff --git a/activerecord/test/cases/relation/mutation_test.rb b/activerecord/test/cases/relation/mutation_test.rb index dea787c07f..113ddaa780 100644 --- a/activerecord/test/cases/relation/mutation_test.rb +++ b/activerecord/test/cases/relation/mutation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" diff --git a/activerecord/test/cases/relation/or_test.rb b/activerecord/test/cases/relation/or_test.rb index 61b6601580..541feabeb6 100644 --- a/activerecord/test/cases/relation/or_test.rb +++ b/activerecord/test/cases/relation/or_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" diff --git a/activerecord/test/cases/relation/predicate_builder_test.rb b/activerecord/test/cases/relation/predicate_builder_test.rb index 48758dc148..94cd704a14 100644 --- a/activerecord/test/cases/relation/predicate_builder_test.rb +++ b/activerecord/test/cases/relation/predicate_builder_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" diff --git a/activerecord/test/cases/relation/record_fetch_warning_test.rb b/activerecord/test/cases/relation/record_fetch_warning_test.rb index 62ca051431..59eb524f5a 100644 --- a/activerecord/test/cases/relation/record_fetch_warning_test.rb +++ b/activerecord/test/cases/relation/record_fetch_warning_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "active_record/relation/record_fetch_warning" diff --git a/activerecord/test/cases/relation/where_chain_test.rb b/activerecord/test/cases/relation/where_chain_test.rb index 86e150ed79..351e955947 100644 --- a/activerecord/test/cases/relation/where_chain_test.rb +++ b/activerecord/test/cases/relation/where_chain_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/relation/where_clause_test.rb b/activerecord/test/cases/relation/where_clause_test.rb index f8eb0dee91..59a7002774 100644 --- a/activerecord/test/cases/relation/where_clause_test.rb +++ b/activerecord/test/cases/relation/where_clause_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class ActiveRecord::Relation diff --git a/activerecord/test/cases/relation/where_test.rb b/activerecord/test/cases/relation/where_test.rb index 42dae4d569..ac4fcfff1d 100644 --- a/activerecord/test/cases/relation/where_test.rb +++ b/activerecord/test/cases/relation/where_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/author" require "models/binary" diff --git a/activerecord/test/cases/relation_test.rb b/activerecord/test/cases/relation_test.rb index a403824f1a..f81b155657 100644 --- a/activerecord/test/cases/relation_test.rb +++ b/activerecord/test/cases/relation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 5767dec315..c804bbf3a5 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/tag" require "models/tagging" diff --git a/activerecord/test/cases/reload_models_test.rb b/activerecord/test/cases/reload_models_test.rb index 3f4c0c03e3..6c2f9fb5ab 100644 --- a/activerecord/test/cases/reload_models_test.rb +++ b/activerecord/test/cases/reload_models_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/owner" require "models/pet" diff --git a/activerecord/test/cases/reserved_word_test.rb b/activerecord/test/cases/reserved_word_test.rb index f3019a5326..44f7a28215 100644 --- a/activerecord/test/cases/reserved_word_test.rb +++ b/activerecord/test/cases/reserved_word_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class ReservedWordTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/result_test.rb b/activerecord/test/cases/result_test.rb index 1a0b7c6ca7..b4044acd57 100644 --- a/activerecord/test/cases/result_test.rb +++ b/activerecord/test/cases/result_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/sanitize_test.rb b/activerecord/test/cases/sanitize_test.rb index 72f09186e2..a0e7f4ae60 100644 --- a/activerecord/test/cases/sanitize_test.rb +++ b/activerecord/test/cases/sanitize_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/binary" require "models/author" diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb index 4c81e825fa..86a0e93832 100644 --- a/activerecord/test/cases/schema_dumper_test.rb +++ b/activerecord/test/cases/schema_dumper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/schema_loading_test.rb b/activerecord/test/cases/schema_loading_test.rb index 362370ac61..e3b7755f07 100644 --- a/activerecord/test/cases/schema_loading_test.rb +++ b/activerecord/test/cases/schema_loading_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module SchemaLoadCounter diff --git a/activerecord/test/cases/scoping/default_scoping_test.rb b/activerecord/test/cases/scoping/default_scoping_test.rb index 89fb434b27..9919ed5e3f 100644 --- a/activerecord/test/cases/scoping/default_scoping_test.rb +++ b/activerecord/test/cases/scoping/default_scoping_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/scoping/named_scoping_test.rb b/activerecord/test/cases/scoping/named_scoping_test.rb index 483ea7128d..ea338a9847 100644 --- a/activerecord/test/cases/scoping/named_scoping_test.rb +++ b/activerecord/test/cases/scoping/named_scoping_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/topic" diff --git a/activerecord/test/cases/scoping/relation_scoping_test.rb b/activerecord/test/cases/scoping/relation_scoping_test.rb index 10553bf057..644e7eb692 100644 --- a/activerecord/test/cases/scoping/relation_scoping_test.rb +++ b/activerecord/test/cases/scoping/relation_scoping_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/post" require "models/author" diff --git a/activerecord/test/cases/secure_token_test.rb b/activerecord/test/cases/secure_token_test.rb index 7b9cbee40a..987ae3074f 100644 --- a/activerecord/test/cases/secure_token_test.rb +++ b/activerecord/test/cases/secure_token_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/user" diff --git a/activerecord/test/cases/serialization_test.rb b/activerecord/test/cases/serialization_test.rb index ec33ad38f2..82e0311d84 100644 --- a/activerecord/test/cases/serialization_test.rb +++ b/activerecord/test/cases/serialization_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/contact" require "models/topic" diff --git a/activerecord/test/cases/serialized_attribute_test.rb b/activerecord/test/cases/serialized_attribute_test.rb index e1bdaab5cf..6525730350 100644 --- a/activerecord/test/cases/serialized_attribute_test.rb +++ b/activerecord/test/cases/serialized_attribute_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/cases/statement_cache_test.rb b/activerecord/test/cases/statement_cache_test.rb index fab3648564..ee1a8bfc36 100644 --- a/activerecord/test/cases/statement_cache_test.rb +++ b/activerecord/test/cases/statement_cache_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/book" require "models/liquid" diff --git a/activerecord/test/cases/store_test.rb b/activerecord/test/cases/store_test.rb index 633a8a0ebc..0ece0632fe 100644 --- a/activerecord/test/cases/store_test.rb +++ b/activerecord/test/cases/store_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/admin" require "models/admin/user" diff --git a/activerecord/test/cases/suppressor_test.rb b/activerecord/test/cases/suppressor_test.rb index a7d16b7cdb..bc85461322 100644 --- a/activerecord/test/cases/suppressor_test.rb +++ b/activerecord/test/cases/suppressor_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/notification" require "models/user" diff --git a/activerecord/test/cases/tasks/database_tasks_test.rb b/activerecord/test/cases/tasks/database_tasks_test.rb index c47c97e9d9..b8280c4aaf 100644 --- a/activerecord/test/cases/tasks/database_tasks_test.rb +++ b/activerecord/test/cases/tasks/database_tasks_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "active_record/tasks/database_tasks" diff --git a/activerecord/test/cases/tasks/mysql_rake_test.rb b/activerecord/test/cases/tasks/mysql_rake_test.rb index 9c6fb14376..02c0cfbb92 100644 --- a/activerecord/test/cases/tasks/mysql_rake_test.rb +++ b/activerecord/test/cases/tasks/mysql_rake_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "active_record/tasks/database_tasks" diff --git a/activerecord/test/cases/tasks/postgresql_rake_test.rb b/activerecord/test/cases/tasks/postgresql_rake_test.rb index a2e968aedf..9369d1eedb 100644 --- a/activerecord/test/cases/tasks/postgresql_rake_test.rb +++ b/activerecord/test/cases/tasks/postgresql_rake_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "active_record/tasks/database_tasks" diff --git a/activerecord/test/cases/tasks/sqlite_rake_test.rb b/activerecord/test/cases/tasks/sqlite_rake_test.rb index ccb3834fee..0deedad671 100644 --- a/activerecord/test/cases/tasks/sqlite_rake_test.rb +++ b/activerecord/test/cases/tasks/sqlite_rake_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "active_record/tasks/database_tasks" require "pathname" diff --git a/activerecord/test/cases/test_case.rb b/activerecord/test/cases/test_case.rb index 9f594fef85..247d0ec3d1 100644 --- a/activerecord/test/cases/test_case.rb +++ b/activerecord/test/cases/test_case.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/test_case" require "active_support/testing/autorun" require "active_support/testing/method_call_assertions" diff --git a/activerecord/test/cases/test_fixtures_test.rb b/activerecord/test/cases/test_fixtures_test.rb index 58d3bea3a2..e542716563 100644 --- a/activerecord/test/cases/test_fixtures_test.rb +++ b/activerecord/test/cases/test_fixtures_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class TestFixturesTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/time_precision_test.rb b/activerecord/test/cases/time_precision_test.rb index 09c585167e..3a8f8af0e6 100644 --- a/activerecord/test/cases/time_precision_test.rb +++ b/activerecord/test/cases/time_precision_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/timestamp_test.rb b/activerecord/test/cases/timestamp_test.rb index 39b40e3411..0f58c96504 100644 --- a/activerecord/test/cases/timestamp_test.rb +++ b/activerecord/test/cases/timestamp_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "support/ddl_helper" require "models/developer" diff --git a/activerecord/test/cases/touch_later_test.rb b/activerecord/test/cases/touch_later_test.rb index d1e8c649d9..24b5e8886f 100644 --- a/activerecord/test/cases/touch_later_test.rb +++ b/activerecord/test/cases/touch_later_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/invoice" require "models/line_item" diff --git a/activerecord/test/cases/transaction_callbacks_test.rb b/activerecord/test/cases/transaction_callbacks_test.rb index eaa4dd09a9..aa0d8f5e65 100644 --- a/activerecord/test/cases/transaction_callbacks_test.rb +++ b/activerecord/test/cases/transaction_callbacks_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/owner" require "models/pet" diff --git a/activerecord/test/cases/transaction_isolation_test.rb b/activerecord/test/cases/transaction_isolation_test.rb index 58abfadaf4..380d7dbb0a 100644 --- a/activerecord/test/cases/transaction_isolation_test.rb +++ b/activerecord/test/cases/transaction_isolation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" unless ActiveRecord::Base.connection.supports_transaction_isolation? diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index 79ba306ef5..ced6045955 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/cases/type/adapter_specific_registry_test.rb b/activerecord/test/cases/type/adapter_specific_registry_test.rb index 8b836b4793..a723a952ea 100644 --- a/activerecord/test/cases/type/adapter_specific_registry_test.rb +++ b/activerecord/test/cases/type/adapter_specific_registry_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/type/date_time_test.rb b/activerecord/test/cases/type/date_time_test.rb index 6848619ece..9307587564 100644 --- a/activerecord/test/cases/type/date_time_test.rb +++ b/activerecord/test/cases/type/date_time_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/task" diff --git a/activerecord/test/cases/type/integer_test.rb b/activerecord/test/cases/type/integer_test.rb index 368b6d7199..13d6d2093b 100644 --- a/activerecord/test/cases/type/integer_test.rb +++ b/activerecord/test/cases/type/integer_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/company" diff --git a/activerecord/test/cases/type/string_test.rb b/activerecord/test/cases/type/string_test.rb index a95da864fa..899d7ae767 100644 --- a/activerecord/test/cases/type/string_test.rb +++ b/activerecord/test/cases/type/string_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/type/type_map_test.rb b/activerecord/test/cases/type/type_map_test.rb index 2959d36466..f171175b2a 100644 --- a/activerecord/test/cases/type/type_map_test.rb +++ b/activerecord/test/cases/type/type_map_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/type/unsigned_integer_test.rb b/activerecord/test/cases/type/unsigned_integer_test.rb index 1cd4dbc2c5..b0a60a2b3d 100644 --- a/activerecord/test/cases/type/unsigned_integer_test.rb +++ b/activerecord/test/cases/type/unsigned_integer_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/type_test.rb b/activerecord/test/cases/type_test.rb index d45a9b3141..0f9f698760 100644 --- a/activerecord/test/cases/type_test.rb +++ b/activerecord/test/cases/type_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class TypeTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/types_test.rb b/activerecord/test/cases/types_test.rb index 11476ea0ef..ea55bb00cd 100644 --- a/activerecord/test/cases/types_test.rb +++ b/activerecord/test/cases/types_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/unconnected_test.rb b/activerecord/test/cases/unconnected_test.rb index b210584644..30efd03955 100644 --- a/activerecord/test/cases/unconnected_test.rb +++ b/activerecord/test/cases/unconnected_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" class TestRecord < ActiveRecord::Base diff --git a/activerecord/test/cases/validations/absence_validation_test.rb b/activerecord/test/cases/validations/absence_validation_test.rb index 870619e4e7..051f14dbb7 100644 --- a/activerecord/test/cases/validations/absence_validation_test.rb +++ b/activerecord/test/cases/validations/absence_validation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/face" require "models/interest" diff --git a/activerecord/test/cases/validations/association_validation_test.rb b/activerecord/test/cases/validations/association_validation_test.rb index f5ceb27d97..0935dc8c32 100644 --- a/activerecord/test/cases/validations/association_validation_test.rb +++ b/activerecord/test/cases/validations/association_validation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb b/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb index a57065ba75..fdfd568897 100644 --- a/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb +++ b/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" diff --git a/activerecord/test/cases/validations/i18n_validation_test.rb b/activerecord/test/cases/validations/i18n_validation_test.rb index fd88a3ea67..a020c877e7 100644 --- a/activerecord/test/cases/validations/i18n_validation_test.rb +++ b/activerecord/test/cases/validations/i18n_validation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/cases/validations/length_validation_test.rb b/activerecord/test/cases/validations/length_validation_test.rb index ba45c6dcc1..7f840dfa7c 100644 --- a/activerecord/test/cases/validations/length_validation_test.rb +++ b/activerecord/test/cases/validations/length_validation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/owner" require "models/pet" diff --git a/activerecord/test/cases/validations/presence_validation_test.rb b/activerecord/test/cases/validations/presence_validation_test.rb index 13956e26ec..dee8528124 100644 --- a/activerecord/test/cases/validations/presence_validation_test.rb +++ b/activerecord/test/cases/validations/presence_validation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/man" require "models/face" diff --git a/activerecord/test/cases/validations/uniqueness_validation_test.rb b/activerecord/test/cases/validations/uniqueness_validation_test.rb index 28605d2f8e..e943d03720 100644 --- a/activerecord/test/cases/validations/uniqueness_validation_test.rb +++ b/activerecord/test/cases/validations/uniqueness_validation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/cases/validations_repair_helper.rb b/activerecord/test/cases/validations_repair_helper.rb index b30666d876..30299fd2c6 100644 --- a/activerecord/test/cases/validations_repair_helper.rb +++ b/activerecord/test/cases/validations_repair_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ValidationsRepairHelper extend ActiveSupport::Concern diff --git a/activerecord/test/cases/validations_test.rb b/activerecord/test/cases/validations_test.rb index a305aa295a..fc9678211a 100644 --- a/activerecord/test/cases/validations_test.rb +++ b/activerecord/test/cases/validations_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/cases/view_test.rb b/activerecord/test/cases/view_test.rb index 1d21a2454f..89b72ec336 100644 --- a/activerecord/test/cases/view_test.rb +++ b/activerecord/test/cases/view_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/book" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/yaml_serialization_test.rb b/activerecord/test/cases/yaml_serialization_test.rb index bfc13d683d..6b9f632f22 100644 --- a/activerecord/test/cases/yaml_serialization_test.rb +++ b/activerecord/test/cases/yaml_serialization_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/config.rb b/activerecord/test/config.rb index a65e6ff776..d0d1933300 100644 --- a/activerecord/test/config.rb +++ b/activerecord/test/config.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true TEST_ROOT = __dir__ ASSETS_ROOT = TEST_ROOT + "/assets" FIXTURES_ROOT = TEST_ROOT + "/fixtures" diff --git a/activerecord/test/migrations/10_urban/9_add_expressions.rb b/activerecord/test/migrations/10_urban/9_add_expressions.rb index e908c9eabc..db9fda3e05 100644 --- a/activerecord/test/migrations/10_urban/9_add_expressions.rb +++ b/activerecord/test/migrations/10_urban/9_add_expressions.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class AddExpressions < ActiveRecord::Migration::Current def self.up create_table("expressions") do |t| diff --git a/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb b/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb index 43c79bc20b..f13f72eb4e 100644 --- a/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb +++ b/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class GiveMeBigNumbers < ActiveRecord::Migration::Current def self.up create_table :big_numbers do |table| diff --git a/activerecord/test/migrations/magic/1_currencies_have_symbols.rb b/activerecord/test/migrations/magic/1_currencies_have_symbols.rb index d4b0e6cd95..d8a864b213 100644 --- a/activerecord/test/migrations/magic/1_currencies_have_symbols.rb +++ b/activerecord/test/migrations/magic/1_currencies_have_symbols.rb @@ -1,9 +1,10 @@ +# frozen_string_literal: true # coding: ISO-8859-15 class CurrenciesHaveSymbols < ActiveRecord::Migration::Current def self.up - # We use € for default currency symbol - add_column "currencies", "symbol", :string, default: "€" + # We use € for default currency symbol + add_column "currencies", "symbol", :string, default: "€" end def self.down diff --git a/activerecord/test/migrations/missing/1000_people_have_middle_names.rb b/activerecord/test/migrations/missing/1000_people_have_middle_names.rb index e046944e31..a1a5dcbac2 100644 --- a/activerecord/test/migrations/missing/1000_people_have_middle_names.rb +++ b/activerecord/test/migrations/missing/1000_people_have_middle_names.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class PeopleHaveMiddleNames < ActiveRecord::Migration::Current def self.up add_column "people", "middle_name", :string diff --git a/activerecord/test/migrations/missing/1_people_have_last_names.rb b/activerecord/test/migrations/missing/1_people_have_last_names.rb index 50fe2a9c8e..1480b4b8f3 100644 --- a/activerecord/test/migrations/missing/1_people_have_last_names.rb +++ b/activerecord/test/migrations/missing/1_people_have_last_names.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class PeopleHaveLastNames < ActiveRecord::Migration::Current def self.up add_column "people", "last_name", :string diff --git a/activerecord/test/migrations/missing/3_we_need_reminders.rb b/activerecord/test/migrations/missing/3_we_need_reminders.rb index d7c63ac892..e69296a31f 100644 --- a/activerecord/test/migrations/missing/3_we_need_reminders.rb +++ b/activerecord/test/migrations/missing/3_we_need_reminders.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class WeNeedReminders < ActiveRecord::Migration::Current def self.up create_table("reminders") do |t| diff --git a/activerecord/test/migrations/missing/4_innocent_jointable.rb b/activerecord/test/migrations/missing/4_innocent_jointable.rb index bd3bf21576..0c021c6162 100644 --- a/activerecord/test/migrations/missing/4_innocent_jointable.rb +++ b/activerecord/test/migrations/missing/4_innocent_jointable.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class InnocentJointable < ActiveRecord::Migration::Current def self.up create_table("people_reminders", id: false) do |t| diff --git a/activerecord/test/migrations/rename/1_we_need_things.rb b/activerecord/test/migrations/rename/1_we_need_things.rb index 9dce01acfd..411d6f9646 100644 --- a/activerecord/test/migrations/rename/1_we_need_things.rb +++ b/activerecord/test/migrations/rename/1_we_need_things.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class WeNeedThings < ActiveRecord::Migration::Current def self.up create_table("things") do |t| diff --git a/activerecord/test/migrations/rename/2_rename_things.rb b/activerecord/test/migrations/rename/2_rename_things.rb index cb8484e7dc..99b1cec7f5 100644 --- a/activerecord/test/migrations/rename/2_rename_things.rb +++ b/activerecord/test/migrations/rename/2_rename_things.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class RenameThings < ActiveRecord::Migration::Current def self.up rename_table "things", "awesome_things" diff --git a/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb b/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb index 76734bcd7d..65b92fbb85 100644 --- a/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb +++ b/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class PeopleHaveHobbies < ActiveRecord::Migration::Current def self.up add_column "people", "hobbies", :text diff --git a/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb b/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb index 7f883dbb45..7a3bede29a 100644 --- a/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb +++ b/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class PeopleHaveDescriptions < ActiveRecord::Migration::Current def self.up add_column "people", "description", :text diff --git a/activerecord/test/migrations/to_copy2/1_create_articles.rb b/activerecord/test/migrations/to_copy2/1_create_articles.rb index 2e9f5ec6bc..3a82d15aea 100644 --- a/activerecord/test/migrations/to_copy2/1_create_articles.rb +++ b/activerecord/test/migrations/to_copy2/1_create_articles.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class CreateArticles < ActiveRecord::Migration::Current def self.up end diff --git a/activerecord/test/migrations/to_copy2/2_create_comments.rb b/activerecord/test/migrations/to_copy2/2_create_comments.rb index d361847d4b..fb1032f8dd 100644 --- a/activerecord/test/migrations/to_copy2/2_create_comments.rb +++ b/activerecord/test/migrations/to_copy2/2_create_comments.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class CreateComments < ActiveRecord::Migration::Current def self.up end diff --git a/activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb b/activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb index 1a863367dd..ea106d5be4 100644 --- a/activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb +++ b/activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class PeopleHaveHobbies < ActiveRecord::Migration::Current def self.up add_column "people", "hobbies", :string diff --git a/activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb b/activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb index 76734bcd7d..65b92fbb85 100644 --- a/activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb +++ b/activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class PeopleHaveHobbies < ActiveRecord::Migration::Current def self.up add_column "people", "hobbies", :text diff --git a/activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb b/activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb index 7f883dbb45..7a3bede29a 100644 --- a/activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb +++ b/activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class PeopleHaveDescriptions < ActiveRecord::Migration::Current def self.up add_column "people", "description", :text diff --git a/activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb b/activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb index 2e9f5ec6bc..3a82d15aea 100644 --- a/activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb +++ b/activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class CreateArticles < ActiveRecord::Migration::Current def self.up end diff --git a/activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb b/activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb index d361847d4b..fb1032f8dd 100644 --- a/activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb +++ b/activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class CreateComments < ActiveRecord::Migration::Current def self.up end diff --git a/activerecord/test/migrations/valid/1_valid_people_have_last_names.rb b/activerecord/test/migrations/valid/1_valid_people_have_last_names.rb index c450211d8c..1d2193469c 100644 --- a/activerecord/test/migrations/valid/1_valid_people_have_last_names.rb +++ b/activerecord/test/migrations/valid/1_valid_people_have_last_names.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ValidPeopleHaveLastNames < ActiveRecord::Migration::Current def self.up add_column "people", "last_name", :string diff --git a/activerecord/test/migrations/valid/2_we_need_reminders.rb b/activerecord/test/migrations/valid/2_we_need_reminders.rb index d7c63ac892..e69296a31f 100644 --- a/activerecord/test/migrations/valid/2_we_need_reminders.rb +++ b/activerecord/test/migrations/valid/2_we_need_reminders.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class WeNeedReminders < ActiveRecord::Migration::Current def self.up create_table("reminders") do |t| diff --git a/activerecord/test/migrations/valid/3_innocent_jointable.rb b/activerecord/test/migrations/valid/3_innocent_jointable.rb index bd3bf21576..0c021c6162 100644 --- a/activerecord/test/migrations/valid/3_innocent_jointable.rb +++ b/activerecord/test/migrations/valid/3_innocent_jointable.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class InnocentJointable < ActiveRecord::Migration::Current def self.up create_table("people_reminders", id: false) do |t| diff --git a/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb b/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb index c450211d8c..1d2193469c 100644 --- a/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb +++ b/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ValidPeopleHaveLastNames < ActiveRecord::Migration::Current def self.up add_column "people", "last_name", :string diff --git a/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb b/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb index d7c63ac892..e69296a31f 100644 --- a/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb +++ b/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class WeNeedReminders < ActiveRecord::Migration::Current def self.up create_table("reminders") do |t| diff --git a/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb b/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb index bd3bf21576..0c021c6162 100644 --- a/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb +++ b/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class InnocentJointable < ActiveRecord::Migration::Current def self.up create_table("people_reminders", id: false) do |t| diff --git a/activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb b/activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb index 9fd27593f0..f7ef1a9769 100644 --- a/activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb +++ b/activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ValidWithTimestampsPeopleHaveLastNames < ActiveRecord::Migration::Current def self.up add_column "people", "last_name", :string diff --git a/activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb b/activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb index 4a59921136..7732032c5d 100644 --- a/activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb +++ b/activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ValidWithTimestampsWeNeedReminders < ActiveRecord::Migration::Current def self.up create_table("reminders") do |t| diff --git a/activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb b/activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb index be24de6d70..cf652c008a 100644 --- a/activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb +++ b/activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ValidWithTimestampsInnocentJointable < ActiveRecord::Migration::Current def self.up create_table("people_reminders", id: false) do |t| diff --git a/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb b/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb index 6f314c881c..ceb0cc98bf 100644 --- a/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb +++ b/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class MigrationVersionCheck < ActiveRecord::Migration::Current def self.up raise "incorrect migration version" unless version == 20131219224947 diff --git a/activerecord/test/models/admin.rb b/activerecord/test/models/admin.rb index bc3ce23447..6c8a6eddb0 100644 --- a/activerecord/test/models/admin.rb +++ b/activerecord/test/models/admin.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Admin def self.table_name_prefix "admin_" diff --git a/activerecord/test/models/admin/account.rb b/activerecord/test/models/admin/account.rb index bd23192d20..2dddfa8fe9 100644 --- a/activerecord/test/models/admin/account.rb +++ b/activerecord/test/models/admin/account.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Admin::Account < ActiveRecord::Base has_many :users end diff --git a/activerecord/test/models/admin/randomly_named_c1.rb b/activerecord/test/models/admin/randomly_named_c1.rb index b64ae7fc41..dc1c8c66d7 100644 --- a/activerecord/test/models/admin/randomly_named_c1.rb +++ b/activerecord/test/models/admin/randomly_named_c1.rb @@ -1,7 +1,8 @@ -class Admin::ClassNameThatDoesNotFollowCONVENTIONS1 < ActiveRecord::Base - self.table_name = :randomly_named_table2 -end - -class Admin::ClassNameThatDoesNotFollowCONVENTIONS2 < ActiveRecord::Base - self.table_name = :randomly_named_table3 -end +# frozen_string_literal: true +class Admin::ClassNameThatDoesNotFollowCONVENTIONS1 < ActiveRecord::Base + self.table_name = :randomly_named_table2 +end + +class Admin::ClassNameThatDoesNotFollowCONVENTIONS2 < ActiveRecord::Base + self.table_name = :randomly_named_table3 +end diff --git a/activerecord/test/models/admin/user.rb b/activerecord/test/models/admin/user.rb index a76e4b6795..1157ca266c 100644 --- a/activerecord/test/models/admin/user.rb +++ b/activerecord/test/models/admin/user.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Admin::User < ActiveRecord::Base class Coder def initialize(default = {}) diff --git a/activerecord/test/models/aircraft.rb b/activerecord/test/models/aircraft.rb index ebd42ff824..02421afe34 100644 --- a/activerecord/test/models/aircraft.rb +++ b/activerecord/test/models/aircraft.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Aircraft < ActiveRecord::Base self.pluralize_table_names = false has_many :engines, foreign_key: "car_id" diff --git a/activerecord/test/models/arunit2_model.rb b/activerecord/test/models/arunit2_model.rb index 04b8b15d3d..80a8ecc5d8 100644 --- a/activerecord/test/models/arunit2_model.rb +++ b/activerecord/test/models/arunit2_model.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ARUnit2Model < ActiveRecord::Base self.abstract_class = true end diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb index 2d9cba77e0..c3278846d6 100644 --- a/activerecord/test/models/author.rb +++ b/activerecord/test/models/author.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Author < ActiveRecord::Base has_many :posts has_many :serialized_posts diff --git a/activerecord/test/models/auto_id.rb b/activerecord/test/models/auto_id.rb index 82c6544bd5..56479b49eb 100644 --- a/activerecord/test/models/auto_id.rb +++ b/activerecord/test/models/auto_id.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class AutoId < ActiveRecord::Base self.table_name = "auto_id_tests" self.primary_key = "auto_id" diff --git a/activerecord/test/models/autoloadable/extra_firm.rb b/activerecord/test/models/autoloadable/extra_firm.rb index 5578ba0d9b..54c421e459 100644 --- a/activerecord/test/models/autoloadable/extra_firm.rb +++ b/activerecord/test/models/autoloadable/extra_firm.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true class ExtraFirm < Company end diff --git a/activerecord/test/models/binary.rb b/activerecord/test/models/binary.rb index 39b2f5090a..4b1212705b 100644 --- a/activerecord/test/models/binary.rb +++ b/activerecord/test/models/binary.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true class Binary < ActiveRecord::Base end diff --git a/activerecord/test/models/bird.rb b/activerecord/test/models/bird.rb index 24b839135d..ba923b4316 100644 --- a/activerecord/test/models/bird.rb +++ b/activerecord/test/models/bird.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Bird < ActiveRecord::Base belongs_to :pirate validates_presence_of :name diff --git a/activerecord/test/models/book.rb b/activerecord/test/models/book.rb index 6466e1b341..46d5d94da3 100644 --- a/activerecord/test/models/book.rb +++ b/activerecord/test/models/book.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Book < ActiveRecord::Base belongs_to :author diff --git a/activerecord/test/models/boolean.rb b/activerecord/test/models/boolean.rb index 0da228aac2..e2f1bb8a9a 100644 --- a/activerecord/test/models/boolean.rb +++ b/activerecord/test/models/boolean.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Boolean < ActiveRecord::Base def has_fun super diff --git a/activerecord/test/models/bulb.rb b/activerecord/test/models/bulb.rb index 113d21cb84..ad9806db55 100644 --- a/activerecord/test/models/bulb.rb +++ b/activerecord/test/models/bulb.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Bulb < ActiveRecord::Base default_scope { where(name: "defaulty") } belongs_to :car, touch: true diff --git a/activerecord/test/models/cake_designer.rb b/activerecord/test/models/cake_designer.rb index 9c57ef573a..20fa26a556 100644 --- a/activerecord/test/models/cake_designer.rb +++ b/activerecord/test/models/cake_designer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class CakeDesigner < ActiveRecord::Base has_one :chef, as: :employable end diff --git a/activerecord/test/models/car.rb b/activerecord/test/models/car.rb index 92bff7ff96..3c3d9295b0 100644 --- a/activerecord/test/models/car.rb +++ b/activerecord/test/models/car.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Car < ActiveRecord::Base has_many :bulbs has_many :all_bulbs, -> { unscope where: :name }, class_name: "Bulb" diff --git a/activerecord/test/models/carrier.rb b/activerecord/test/models/carrier.rb index 230be118c3..bf8055fbd7 100644 --- a/activerecord/test/models/carrier.rb +++ b/activerecord/test/models/carrier.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true class Carrier < ActiveRecord::Base end diff --git a/activerecord/test/models/cat.rb b/activerecord/test/models/cat.rb index dfdde18641..4c76ec86cf 100644 --- a/activerecord/test/models/cat.rb +++ b/activerecord/test/models/cat.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Cat < ActiveRecord::Base self.abstract_class = true diff --git a/activerecord/test/models/categorization.rb b/activerecord/test/models/categorization.rb index b99383d0b1..87b81e1e2d 100644 --- a/activerecord/test/models/categorization.rb +++ b/activerecord/test/models/categorization.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Categorization < ActiveRecord::Base belongs_to :post belongs_to :category, counter_cache: true diff --git a/activerecord/test/models/category.rb b/activerecord/test/models/category.rb index 4b2840c653..392fe94fe7 100644 --- a/activerecord/test/models/category.rb +++ b/activerecord/test/models/category.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Category < ActiveRecord::Base has_and_belongs_to_many :posts has_and_belongs_to_many :special_posts, class_name: "Post" diff --git a/activerecord/test/models/chef.rb b/activerecord/test/models/chef.rb index 9d3dd01016..daa208ff5f 100644 --- a/activerecord/test/models/chef.rb +++ b/activerecord/test/models/chef.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Chef < ActiveRecord::Base belongs_to :employable, polymorphic: true has_many :recipes diff --git a/activerecord/test/models/citation.rb b/activerecord/test/models/citation.rb index 7d06387f56..8a6c300a28 100644 --- a/activerecord/test/models/citation.rb +++ b/activerecord/test/models/citation.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Citation < ActiveRecord::Base belongs_to :reference_of, class_name: "Book", foreign_key: :book2_id end diff --git a/activerecord/test/models/club.rb b/activerecord/test/models/club.rb index 49d7b24a3b..cdd5b37792 100644 --- a/activerecord/test/models/club.rb +++ b/activerecord/test/models/club.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Club < ActiveRecord::Base has_one :membership has_many :memberships, inverse_of: false diff --git a/activerecord/test/models/college.rb b/activerecord/test/models/college.rb index c9dbe1ecc2..70c0cd1534 100644 --- a/activerecord/test/models/college.rb +++ b/activerecord/test/models/college.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require_dependency "models/arunit2_model" require "active_support/core_ext/object/with_options" diff --git a/activerecord/test/models/column.rb b/activerecord/test/models/column.rb index 499358b4cf..08e1a4ae2d 100644 --- a/activerecord/test/models/column.rb +++ b/activerecord/test/models/column.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Column < ActiveRecord::Base belongs_to :record end diff --git a/activerecord/test/models/column_name.rb b/activerecord/test/models/column_name.rb index 460eb4fe20..3b4452c3c2 100644 --- a/activerecord/test/models/column_name.rb +++ b/activerecord/test/models/column_name.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ColumnName < ActiveRecord::Base self.table_name = "colnametests" end diff --git a/activerecord/test/models/comment.rb b/activerecord/test/models/comment.rb index eecf923046..6c10ec0858 100644 --- a/activerecord/test/models/comment.rb +++ b/activerecord/test/models/comment.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Comment < ActiveRecord::Base scope :limit_by, lambda { |l| limit(l) } scope :containing_the_letter_e, -> { where("comments.body LIKE '%e%'") } diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index c6a5bf1c92..8a6d909188 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class AbstractCompany < ActiveRecord::Base self.abstract_class = true end diff --git a/activerecord/test/models/company_in_module.rb b/activerecord/test/models/company_in_module.rb index 0782c1eff4..2e7295eed1 100644 --- a/activerecord/test/models/company_in_module.rb +++ b/activerecord/test/models/company_in_module.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/object/with_options" module MyApplication diff --git a/activerecord/test/models/computer.rb b/activerecord/test/models/computer.rb index 1c9856e1af..f2998d362a 100644 --- a/activerecord/test/models/computer.rb +++ b/activerecord/test/models/computer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Computer < ActiveRecord::Base belongs_to :developer, foreign_key: "developer" end diff --git a/activerecord/test/models/contact.rb b/activerecord/test/models/contact.rb index 47bbbbfd8b..0a095301bd 100644 --- a/activerecord/test/models/contact.rb +++ b/activerecord/test/models/contact.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ContactFakeColumns def self.extended(base) base.class_eval do diff --git a/activerecord/test/models/content.rb b/activerecord/test/models/content.rb index 68db2127d8..f2913be22d 100644 --- a/activerecord/test/models/content.rb +++ b/activerecord/test/models/content.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Content < ActiveRecord::Base self.table_name = "content" has_one :content_position, dependent: :destroy diff --git a/activerecord/test/models/contract.rb b/activerecord/test/models/contract.rb index 32bd581377..e4bace0e32 100644 --- a/activerecord/test/models/contract.rb +++ b/activerecord/test/models/contract.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Contract < ActiveRecord::Base belongs_to :company belongs_to :developer diff --git a/activerecord/test/models/country.rb b/activerecord/test/models/country.rb index 7912719ddd..5c1c6dc492 100644 --- a/activerecord/test/models/country.rb +++ b/activerecord/test/models/country.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Country < ActiveRecord::Base self.primary_key = :country_id diff --git a/activerecord/test/models/course.rb b/activerecord/test/models/course.rb index 348f2bf1e0..0af33ed85f 100644 --- a/activerecord/test/models/course.rb +++ b/activerecord/test/models/course.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require_dependency "models/arunit2_model" class Course < ARUnit2Model diff --git a/activerecord/test/models/customer.rb b/activerecord/test/models/customer.rb index 3d40cb1ace..2eb4c720a6 100644 --- a/activerecord/test/models/customer.rb +++ b/activerecord/test/models/customer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Customer < ActiveRecord::Base cattr_accessor :gps_conversion_was_run diff --git a/activerecord/test/models/customer_carrier.rb b/activerecord/test/models/customer_carrier.rb index 37186903ff..3d236da43d 100644 --- a/activerecord/test/models/customer_carrier.rb +++ b/activerecord/test/models/customer_carrier.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class CustomerCarrier < ActiveRecord::Base cattr_accessor :current_customer diff --git a/activerecord/test/models/dashboard.rb b/activerecord/test/models/dashboard.rb index 1b3b54545f..fe54e9d6fc 100644 --- a/activerecord/test/models/dashboard.rb +++ b/activerecord/test/models/dashboard.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Dashboard < ActiveRecord::Base self.primary_key = :dashboard_id end diff --git a/activerecord/test/models/default.rb b/activerecord/test/models/default.rb index 887e9cc999..6f87ee74f7 100644 --- a/activerecord/test/models/default.rb +++ b/activerecord/test/models/default.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true class Default < ActiveRecord::Base end diff --git a/activerecord/test/models/department.rb b/activerecord/test/models/department.rb index 08004a0ed3..e8cdae8976 100644 --- a/activerecord/test/models/department.rb +++ b/activerecord/test/models/department.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Department < ActiveRecord::Base has_many :chefs belongs_to :hotel diff --git a/activerecord/test/models/developer.rb b/activerecord/test/models/developer.rb index 654830ba11..aa7798c582 100644 --- a/activerecord/test/models/developer.rb +++ b/activerecord/test/models/developer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "ostruct" module DeveloperProjectsAssociationExtension2 diff --git a/activerecord/test/models/dog.rb b/activerecord/test/models/dog.rb index b02b8447b8..08eeb6b75e 100644 --- a/activerecord/test/models/dog.rb +++ b/activerecord/test/models/dog.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Dog < ActiveRecord::Base belongs_to :breeder, class_name: "DogLover", counter_cache: :bred_dogs_count belongs_to :trainer, class_name: "DogLover", counter_cache: :trained_dogs_count diff --git a/activerecord/test/models/dog_lover.rb b/activerecord/test/models/dog_lover.rb index 2c5be94aea..75e43bda8a 100644 --- a/activerecord/test/models/dog_lover.rb +++ b/activerecord/test/models/dog_lover.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class DogLover < ActiveRecord::Base has_many :trained_dogs, class_name: "Dog", foreign_key: :trainer_id, dependent: :destroy has_many :bred_dogs, class_name: "Dog", foreign_key: :breeder_id diff --git a/activerecord/test/models/doubloon.rb b/activerecord/test/models/doubloon.rb index 7272504666..e18868e022 100644 --- a/activerecord/test/models/doubloon.rb +++ b/activerecord/test/models/doubloon.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class AbstractDoubloon < ActiveRecord::Base # This has functionality that might be shared by multiple classes. diff --git a/activerecord/test/models/drink_designer.rb b/activerecord/test/models/drink_designer.rb index 2db968ef11..9de6e3d618 100644 --- a/activerecord/test/models/drink_designer.rb +++ b/activerecord/test/models/drink_designer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class DrinkDesigner < ActiveRecord::Base has_one :chef, as: :employable end diff --git a/activerecord/test/models/edge.rb b/activerecord/test/models/edge.rb index e61d25c9bc..9711ea6da9 100644 --- a/activerecord/test/models/edge.rb +++ b/activerecord/test/models/edge.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # This class models an edge in a directed graph. class Edge < ActiveRecord::Base belongs_to :source, class_name: "Vertex", foreign_key: "source_id" diff --git a/activerecord/test/models/electron.rb b/activerecord/test/models/electron.rb index 6fc270673f..1828d173bb 100644 --- a/activerecord/test/models/electron.rb +++ b/activerecord/test/models/electron.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Electron < ActiveRecord::Base belongs_to :molecule diff --git a/activerecord/test/models/engine.rb b/activerecord/test/models/engine.rb index eada171f6a..144bf7159b 100644 --- a/activerecord/test/models/engine.rb +++ b/activerecord/test/models/engine.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Engine < ActiveRecord::Base belongs_to :my_car, class_name: "Car", foreign_key: "car_id", counter_cache: :engines_count end diff --git a/activerecord/test/models/entrant.rb b/activerecord/test/models/entrant.rb index 4682ce48c8..77095e28c5 100644 --- a/activerecord/test/models/entrant.rb +++ b/activerecord/test/models/entrant.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Entrant < ActiveRecord::Base belongs_to :course end diff --git a/activerecord/test/models/essay.rb b/activerecord/test/models/essay.rb index 1f9772870e..302a862907 100644 --- a/activerecord/test/models/essay.rb +++ b/activerecord/test/models/essay.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Essay < ActiveRecord::Base belongs_to :author belongs_to :writer, primary_key: :name, polymorphic: true diff --git a/activerecord/test/models/event.rb b/activerecord/test/models/event.rb index 365ab32b0b..ac9bc63f34 100644 --- a/activerecord/test/models/event.rb +++ b/activerecord/test/models/event.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Event < ActiveRecord::Base validates_uniqueness_of :title end diff --git a/activerecord/test/models/eye.rb b/activerecord/test/models/eye.rb index f53c34e4b1..a7410e8aa9 100644 --- a/activerecord/test/models/eye.rb +++ b/activerecord/test/models/eye.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Eye < ActiveRecord::Base attr_reader :after_create_callbacks_stack attr_reader :after_update_callbacks_stack diff --git a/activerecord/test/models/face.rb b/activerecord/test/models/face.rb index 5913bfa969..3c78bf9284 100644 --- a/activerecord/test/models/face.rb +++ b/activerecord/test/models/face.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Face < ActiveRecord::Base belongs_to :man, inverse_of: :face belongs_to :polymorphic_man, polymorphic: true, inverse_of: :polymorphic_face diff --git a/activerecord/test/models/family.rb b/activerecord/test/models/family.rb index 5ae5a78c95..24bc3cc457 100644 --- a/activerecord/test/models/family.rb +++ b/activerecord/test/models/family.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Family < ActiveRecord::Base has_many :family_trees, -> { where(token: nil) } has_many :members, through: :family_trees diff --git a/activerecord/test/models/family_tree.rb b/activerecord/test/models/family_tree.rb index cd9829fedd..94a905246a 100644 --- a/activerecord/test/models/family_tree.rb +++ b/activerecord/test/models/family_tree.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class FamilyTree < ActiveRecord::Base belongs_to :member, class_name: "User", foreign_key: "member_id" belongs_to :family diff --git a/activerecord/test/models/friendship.rb b/activerecord/test/models/friendship.rb index 578382b494..e9ecfe7e25 100644 --- a/activerecord/test/models/friendship.rb +++ b/activerecord/test/models/friendship.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Friendship < ActiveRecord::Base belongs_to :friend, class_name: "Person" # friend_too exists to test a bug, and probably shouldn't be used elsewhere diff --git a/activerecord/test/models/guid.rb b/activerecord/test/models/guid.rb index 05653ba498..8653b617b1 100644 --- a/activerecord/test/models/guid.rb +++ b/activerecord/test/models/guid.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true class Guid < ActiveRecord::Base end diff --git a/activerecord/test/models/guitar.rb b/activerecord/test/models/guitar.rb index cd068ff53d..a1a3226272 100644 --- a/activerecord/test/models/guitar.rb +++ b/activerecord/test/models/guitar.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Guitar < ActiveRecord::Base has_many :tuning_pegs, index_errors: true accepts_nested_attributes_for :tuning_pegs diff --git a/activerecord/test/models/hotel.rb b/activerecord/test/models/hotel.rb index 7bc717c891..1d20d17e3b 100644 --- a/activerecord/test/models/hotel.rb +++ b/activerecord/test/models/hotel.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Hotel < ActiveRecord::Base has_many :departments has_many :chefs, through: :departments diff --git a/activerecord/test/models/image.rb b/activerecord/test/models/image.rb index 7ae8e4a7f6..1efe679022 100644 --- a/activerecord/test/models/image.rb +++ b/activerecord/test/models/image.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Image < ActiveRecord::Base belongs_to :imageable, foreign_key: :imageable_identifier, foreign_type: :imageable_class end diff --git a/activerecord/test/models/interest.rb b/activerecord/test/models/interest.rb index ec79416ee7..10e855be4d 100644 --- a/activerecord/test/models/interest.rb +++ b/activerecord/test/models/interest.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Interest < ActiveRecord::Base belongs_to :man, inverse_of: :interests belongs_to :polymorphic_man, polymorphic: true, inverse_of: :polymorphic_interests diff --git a/activerecord/test/models/invoice.rb b/activerecord/test/models/invoice.rb index 4be5a00193..df37e2a9e1 100644 --- a/activerecord/test/models/invoice.rb +++ b/activerecord/test/models/invoice.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Invoice < ActiveRecord::Base has_many :line_items, autosave: true before_save { |record| record.balance = record.line_items.map(&:amount).sum } diff --git a/activerecord/test/models/item.rb b/activerecord/test/models/item.rb index 336fb1769a..86a1fc625e 100644 --- a/activerecord/test/models/item.rb +++ b/activerecord/test/models/item.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class AbstractItem < ActiveRecord::Base self.abstract_class = true has_one :tagging, as: :taggable diff --git a/activerecord/test/models/job.rb b/activerecord/test/models/job.rb index bbaef2792c..6c4dff4bcd 100644 --- a/activerecord/test/models/job.rb +++ b/activerecord/test/models/job.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Job < ActiveRecord::Base has_many :references has_many :people, through: :references diff --git a/activerecord/test/models/joke.rb b/activerecord/test/models/joke.rb index eeb5818a1f..5c2443036a 100644 --- a/activerecord/test/models/joke.rb +++ b/activerecord/test/models/joke.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Joke < ActiveRecord::Base self.table_name = "funny_jokes" end diff --git a/activerecord/test/models/keyboard.rb b/activerecord/test/models/keyboard.rb index bcede53ec9..d179de8e1c 100644 --- a/activerecord/test/models/keyboard.rb +++ b/activerecord/test/models/keyboard.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Keyboard < ActiveRecord::Base self.primary_key = "key_number" end diff --git a/activerecord/test/models/legacy_thing.rb b/activerecord/test/models/legacy_thing.rb index eead181a0e..948d575bb8 100644 --- a/activerecord/test/models/legacy_thing.rb +++ b/activerecord/test/models/legacy_thing.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class LegacyThing < ActiveRecord::Base self.locking_column = :version end diff --git a/activerecord/test/models/lesson.rb b/activerecord/test/models/lesson.rb index 4c88153068..086ff55b42 100644 --- a/activerecord/test/models/lesson.rb +++ b/activerecord/test/models/lesson.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class LessonError < Exception end diff --git a/activerecord/test/models/line_item.rb b/activerecord/test/models/line_item.rb index 93f7cceb13..1ef2eda97a 100644 --- a/activerecord/test/models/line_item.rb +++ b/activerecord/test/models/line_item.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class LineItem < ActiveRecord::Base belongs_to :invoice, touch: true end diff --git a/activerecord/test/models/liquid.rb b/activerecord/test/models/liquid.rb index 69d4d7df1a..9440292c78 100644 --- a/activerecord/test/models/liquid.rb +++ b/activerecord/test/models/liquid.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Liquid < ActiveRecord::Base self.table_name = :liquid has_many :molecules, -> { distinct } diff --git a/activerecord/test/models/man.rb b/activerecord/test/models/man.rb index d2436a735c..bf81aa9fc6 100644 --- a/activerecord/test/models/man.rb +++ b/activerecord/test/models/man.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Man < ActiveRecord::Base has_one :face, inverse_of: :man has_one :polymorphic_face, class_name: "Face", as: :polymorphic_man, inverse_of: :polymorphic_man diff --git a/activerecord/test/models/matey.rb b/activerecord/test/models/matey.rb index 80ee5f47c5..00311f78fe 100644 --- a/activerecord/test/models/matey.rb +++ b/activerecord/test/models/matey.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Matey < ActiveRecord::Base belongs_to :pirate belongs_to :target, class_name: "Pirate" diff --git a/activerecord/test/models/member.rb b/activerecord/test/models/member.rb index 36f2461b84..99a037e0f6 100644 --- a/activerecord/test/models/member.rb +++ b/activerecord/test/models/member.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Member < ActiveRecord::Base has_one :current_membership has_one :selected_membership diff --git a/activerecord/test/models/member_detail.rb b/activerecord/test/models/member_detail.rb index 157130986c..8311d202da 100644 --- a/activerecord/test/models/member_detail.rb +++ b/activerecord/test/models/member_detail.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class MemberDetail < ActiveRecord::Base belongs_to :member, inverse_of: false belongs_to :organization diff --git a/activerecord/test/models/member_type.rb b/activerecord/test/models/member_type.rb index a13561c72a..3c159a885a 100644 --- a/activerecord/test/models/member_type.rb +++ b/activerecord/test/models/member_type.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class MemberType < ActiveRecord::Base has_many :members end diff --git a/activerecord/test/models/membership.rb b/activerecord/test/models/membership.rb index 0f8be0ad85..bd957f1de8 100644 --- a/activerecord/test/models/membership.rb +++ b/activerecord/test/models/membership.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Membership < ActiveRecord::Base enum type: %i(Membership CurrentMembership SuperMembership SelectedMembership TenantMembership) belongs_to :member diff --git a/activerecord/test/models/mentor.rb b/activerecord/test/models/mentor.rb index 66504b4e91..9e52d39e46 100644 --- a/activerecord/test/models/mentor.rb +++ b/activerecord/test/models/mentor.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Mentor < ActiveRecord::Base has_many :developers end diff --git a/activerecord/test/models/minimalistic.rb b/activerecord/test/models/minimalistic.rb index 2e3f8e081a..c31eea65c9 100644 --- a/activerecord/test/models/minimalistic.rb +++ b/activerecord/test/models/minimalistic.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true class Minimalistic < ActiveRecord::Base end diff --git a/activerecord/test/models/minivan.rb b/activerecord/test/models/minivan.rb index e9b05dadf2..4d04d808a9 100644 --- a/activerecord/test/models/minivan.rb +++ b/activerecord/test/models/minivan.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Minivan < ActiveRecord::Base self.primary_key = :minivan_id diff --git a/activerecord/test/models/mixed_case_monkey.rb b/activerecord/test/models/mixed_case_monkey.rb index 1c35006665..552de2c18c 100644 --- a/activerecord/test/models/mixed_case_monkey.rb +++ b/activerecord/test/models/mixed_case_monkey.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class MixedCaseMonkey < ActiveRecord::Base belongs_to :man end diff --git a/activerecord/test/models/mocktail_designer.rb b/activerecord/test/models/mocktail_designer.rb index 77b44651a3..fc9fc4c942 100644 --- a/activerecord/test/models/mocktail_designer.rb +++ b/activerecord/test/models/mocktail_designer.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true class MocktailDesigner < DrinkDesigner end diff --git a/activerecord/test/models/molecule.rb b/activerecord/test/models/molecule.rb index 26870c8f88..8e0f6eb6ee 100644 --- a/activerecord/test/models/molecule.rb +++ b/activerecord/test/models/molecule.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Molecule < ActiveRecord::Base belongs_to :liquid has_many :electrons diff --git a/activerecord/test/models/movie.rb b/activerecord/test/models/movie.rb index 0302abad1e..fc620656e4 100644 --- a/activerecord/test/models/movie.rb +++ b/activerecord/test/models/movie.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Movie < ActiveRecord::Base self.primary_key = "movieid" diff --git a/activerecord/test/models/node.rb b/activerecord/test/models/node.rb index 459ea8cf95..3422a9ea3a 100644 --- a/activerecord/test/models/node.rb +++ b/activerecord/test/models/node.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Node < ActiveRecord::Base belongs_to :tree, touch: true belongs_to :parent, class_name: "Node", touch: true, optional: true diff --git a/activerecord/test/models/non_primary_key.rb b/activerecord/test/models/non_primary_key.rb index 1cafb09608..4a5fdb88b8 100644 --- a/activerecord/test/models/non_primary_key.rb +++ b/activerecord/test/models/non_primary_key.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true class NonPrimaryKey < ActiveRecord::Base end diff --git a/activerecord/test/models/notification.rb b/activerecord/test/models/notification.rb index 82edc64b68..9e8ce108d5 100644 --- a/activerecord/test/models/notification.rb +++ b/activerecord/test/models/notification.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Notification < ActiveRecord::Base validates_presence_of :message end diff --git a/activerecord/test/models/numeric_data.rb b/activerecord/test/models/numeric_data.rb index c6e025a9ce..8998495101 100644 --- a/activerecord/test/models/numeric_data.rb +++ b/activerecord/test/models/numeric_data.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class NumericData < ActiveRecord::Base self.table_name = "numeric_data" # Decimal columns with 0 scale being automatically treated as integers diff --git a/activerecord/test/models/order.rb b/activerecord/test/models/order.rb index 699be53959..c8693586a0 100644 --- a/activerecord/test/models/order.rb +++ b/activerecord/test/models/order.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Order < ActiveRecord::Base belongs_to :billing, class_name: "Customer", foreign_key: "billing_customer_id" belongs_to :shipping, class_name: "Customer", foreign_key: "shipping_customer_id" diff --git a/activerecord/test/models/organization.rb b/activerecord/test/models/organization.rb index 462830dadc..c08a01994b 100644 --- a/activerecord/test/models/organization.rb +++ b/activerecord/test/models/organization.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Organization < ActiveRecord::Base has_many :member_details has_many :members, through: :member_details diff --git a/activerecord/test/models/other_dog.rb b/activerecord/test/models/other_dog.rb index 418caf34be..a836d9de1a 100644 --- a/activerecord/test/models/other_dog.rb +++ b/activerecord/test/models/other_dog.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require_dependency "models/arunit2_model" class OtherDog < ARUnit2Model diff --git a/activerecord/test/models/owner.rb b/activerecord/test/models/owner.rb index 21fc9b6eb8..f6190fe5af 100644 --- a/activerecord/test/models/owner.rb +++ b/activerecord/test/models/owner.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Owner < ActiveRecord::Base self.primary_key = :owner_id has_many :pets, -> { order "pets.name desc" } diff --git a/activerecord/test/models/parrot.rb b/activerecord/test/models/parrot.rb index 1e5f9285a8..4a027fa0bb 100644 --- a/activerecord/test/models/parrot.rb +++ b/activerecord/test/models/parrot.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Parrot < ActiveRecord::Base self.inheritance_column = :parrot_sti_class diff --git a/activerecord/test/models/person.rb b/activerecord/test/models/person.rb index 18994d6f18..c1ea965a6e 100644 --- a/activerecord/test/models/person.rb +++ b/activerecord/test/models/person.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Person < ActiveRecord::Base has_many :readers has_many :secure_readers diff --git a/activerecord/test/models/personal_legacy_thing.rb b/activerecord/test/models/personal_legacy_thing.rb index adde7a504a..1a70aa7e7b 100644 --- a/activerecord/test/models/personal_legacy_thing.rb +++ b/activerecord/test/models/personal_legacy_thing.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class PersonalLegacyThing < ActiveRecord::Base self.locking_column = :version belongs_to :person, counter_cache: true diff --git a/activerecord/test/models/pet.rb b/activerecord/test/models/pet.rb index 51a3e42815..f0d82ddfc9 100644 --- a/activerecord/test/models/pet.rb +++ b/activerecord/test/models/pet.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Pet < ActiveRecord::Base attr_accessor :current_user diff --git a/activerecord/test/models/pet_treasure.rb b/activerecord/test/models/pet_treasure.rb index 1fe7807ffe..2d552bf50c 100644 --- a/activerecord/test/models/pet_treasure.rb +++ b/activerecord/test/models/pet_treasure.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class PetTreasure < ActiveRecord::Base self.table_name = "pets_treasures" diff --git a/activerecord/test/models/pirate.rb b/activerecord/test/models/pirate.rb index c532ab426e..21fe1b7847 100644 --- a/activerecord/test/models/pirate.rb +++ b/activerecord/test/models/pirate.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Pirate < ActiveRecord::Base belongs_to :parrot, validate: true belongs_to :non_validated_parrot, class_name: "Parrot" diff --git a/activerecord/test/models/possession.rb b/activerecord/test/models/possession.rb index 0226336c16..d8c2a5f21f 100644 --- a/activerecord/test/models/possession.rb +++ b/activerecord/test/models/possession.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Possession < ActiveRecord::Base self.table_name = "having" end diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb index ed64e0ee52..534ba47c98 100644 --- a/activerecord/test/models/post.rb +++ b/activerecord/test/models/post.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Post < ActiveRecord::Base class CategoryPost < ActiveRecord::Base self.table_name = "categories_posts" diff --git a/activerecord/test/models/price_estimate.rb b/activerecord/test/models/price_estimate.rb index ce086e40a3..abdff640c7 100644 --- a/activerecord/test/models/price_estimate.rb +++ b/activerecord/test/models/price_estimate.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class PriceEstimate < ActiveRecord::Base belongs_to :estimate_of, polymorphic: true belongs_to :thing, polymorphic: true diff --git a/activerecord/test/models/professor.rb b/activerecord/test/models/professor.rb index 4dfb1a9602..6ec183bb07 100644 --- a/activerecord/test/models/professor.rb +++ b/activerecord/test/models/professor.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require_dependency "models/arunit2_model" class Professor < ARUnit2Model diff --git a/activerecord/test/models/project.rb b/activerecord/test/models/project.rb index 4fbd986e40..e30f1d729a 100644 --- a/activerecord/test/models/project.rb +++ b/activerecord/test/models/project.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Project < ActiveRecord::Base belongs_to :mentor has_and_belongs_to_many :developers, -> { distinct.order "developers.name desc, developers.id desc" } diff --git a/activerecord/test/models/publisher.rb b/activerecord/test/models/publisher.rb index 0d4a7f9235..55cf0e42a5 100644 --- a/activerecord/test/models/publisher.rb +++ b/activerecord/test/models/publisher.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true module Publisher end diff --git a/activerecord/test/models/publisher/article.rb b/activerecord/test/models/publisher/article.rb index d73a8eb936..43b88117e0 100644 --- a/activerecord/test/models/publisher/article.rb +++ b/activerecord/test/models/publisher/article.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Publisher::Article < ActiveRecord::Base has_and_belongs_to_many :magazines has_and_belongs_to_many :tags diff --git a/activerecord/test/models/publisher/magazine.rb b/activerecord/test/models/publisher/magazine.rb index 82e1a14008..25e34aca99 100644 --- a/activerecord/test/models/publisher/magazine.rb +++ b/activerecord/test/models/publisher/magazine.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Publisher::Magazine < ActiveRecord::Base has_and_belongs_to_many :articles end diff --git a/activerecord/test/models/randomly_named_c1.rb b/activerecord/test/models/randomly_named_c1.rb index d4be1e13b4..1cd2ca1bb8 100644 --- a/activerecord/test/models/randomly_named_c1.rb +++ b/activerecord/test/models/randomly_named_c1.rb @@ -1,3 +1,4 @@ -class ClassNameThatDoesNotFollowCONVENTIONS < ActiveRecord::Base - self.table_name = :randomly_named_table1 -end +# frozen_string_literal: true +class ClassNameThatDoesNotFollowCONVENTIONS < ActiveRecord::Base + self.table_name = :randomly_named_table1 +end diff --git a/activerecord/test/models/rating.rb b/activerecord/test/models/rating.rb index 7420821db0..753df20e8d 100644 --- a/activerecord/test/models/rating.rb +++ b/activerecord/test/models/rating.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Rating < ActiveRecord::Base belongs_to :comment has_many :taggings, as: :taggable diff --git a/activerecord/test/models/reader.rb b/activerecord/test/models/reader.rb index 7c5a159fe0..05a17eca8b 100644 --- a/activerecord/test/models/reader.rb +++ b/activerecord/test/models/reader.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Reader < ActiveRecord::Base belongs_to :post belongs_to :person, inverse_of: :readers diff --git a/activerecord/test/models/recipe.rb b/activerecord/test/models/recipe.rb index c387230603..8f81807340 100644 --- a/activerecord/test/models/recipe.rb +++ b/activerecord/test/models/recipe.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Recipe < ActiveRecord::Base belongs_to :chef end diff --git a/activerecord/test/models/record.rb b/activerecord/test/models/record.rb index f77ac9fc03..81d5baa6b1 100644 --- a/activerecord/test/models/record.rb +++ b/activerecord/test/models/record.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true class Record < ActiveRecord::Base end diff --git a/activerecord/test/models/reference.rb b/activerecord/test/models/reference.rb index e2bb980fed..5daa48d8ce 100644 --- a/activerecord/test/models/reference.rb +++ b/activerecord/test/models/reference.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Reference < ActiveRecord::Base belongs_to :person belongs_to :job diff --git a/activerecord/test/models/reply.rb b/activerecord/test/models/reply.rb index a2d169292a..f3372e81fd 100644 --- a/activerecord/test/models/reply.rb +++ b/activerecord/test/models/reply.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "models/topic" class Reply < Topic diff --git a/activerecord/test/models/ship.rb b/activerecord/test/models/ship.rb index 77a7b22315..0ee8da78db 100644 --- a/activerecord/test/models/ship.rb +++ b/activerecord/test/models/ship.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Ship < ActiveRecord::Base self.record_timestamps = false diff --git a/activerecord/test/models/ship_part.rb b/activerecord/test/models/ship_part.rb index 1a633b8d77..67c089a7d0 100644 --- a/activerecord/test/models/ship_part.rb +++ b/activerecord/test/models/ship_part.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ShipPart < ActiveRecord::Base belongs_to :ship has_many :trinkets, class_name: "Treasure", as: :looter diff --git a/activerecord/test/models/shop.rb b/activerecord/test/models/shop.rb index f9d23d13b0..819af853ad 100644 --- a/activerecord/test/models/shop.rb +++ b/activerecord/test/models/shop.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Shop class Collection < ActiveRecord::Base has_many :products, dependent: :nullify diff --git a/activerecord/test/models/shop_account.rb b/activerecord/test/models/shop_account.rb index 1580e8b20c..cb00e202f0 100644 --- a/activerecord/test/models/shop_account.rb +++ b/activerecord/test/models/shop_account.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ShopAccount < ActiveRecord::Base belongs_to :customer belongs_to :customer_carrier diff --git a/activerecord/test/models/speedometer.rb b/activerecord/test/models/speedometer.rb index 497c3aba9a..b34e3c16fc 100644 --- a/activerecord/test/models/speedometer.rb +++ b/activerecord/test/models/speedometer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Speedometer < ActiveRecord::Base self.primary_key = :speedometer_id belongs_to :dashboard diff --git a/activerecord/test/models/sponsor.rb b/activerecord/test/models/sponsor.rb index 3f142b25fe..cfcd1f762a 100644 --- a/activerecord/test/models/sponsor.rb +++ b/activerecord/test/models/sponsor.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Sponsor < ActiveRecord::Base belongs_to :sponsor_club, class_name: "Club", foreign_key: "club_id" belongs_to :sponsorable, polymorphic: true diff --git a/activerecord/test/models/string_key_object.rb b/activerecord/test/models/string_key_object.rb index f084ec1bdc..94c7fb7582 100644 --- a/activerecord/test/models/string_key_object.rb +++ b/activerecord/test/models/string_key_object.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class StringKeyObject < ActiveRecord::Base self.primary_key = :id end diff --git a/activerecord/test/models/student.rb b/activerecord/test/models/student.rb index 28a0b6c99b..888a0ae481 100644 --- a/activerecord/test/models/student.rb +++ b/activerecord/test/models/student.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Student < ActiveRecord::Base has_and_belongs_to_many :lessons belongs_to :college diff --git a/activerecord/test/models/subscriber.rb b/activerecord/test/models/subscriber.rb index a820329003..8ef679486d 100644 --- a/activerecord/test/models/subscriber.rb +++ b/activerecord/test/models/subscriber.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Subscriber < ActiveRecord::Base self.primary_key = "nick" has_many :subscriptions diff --git a/activerecord/test/models/subscription.rb b/activerecord/test/models/subscription.rb index 1cedf6deae..e210836413 100644 --- a/activerecord/test/models/subscription.rb +++ b/activerecord/test/models/subscription.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Subscription < ActiveRecord::Base belongs_to :subscriber, counter_cache: :books_count belongs_to :book diff --git a/activerecord/test/models/tag.rb b/activerecord/test/models/tag.rb index c907aea10f..6c59dc6183 100644 --- a/activerecord/test/models/tag.rb +++ b/activerecord/test/models/tag.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Tag < ActiveRecord::Base has_many :taggings has_many :taggables, through: :taggings diff --git a/activerecord/test/models/tagging.rb b/activerecord/test/models/tagging.rb index f739b4a197..0060b96f73 100644 --- a/activerecord/test/models/tagging.rb +++ b/activerecord/test/models/tagging.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # test that attr_readonly isn't called on the :taggable polymorphic association module Taggable end diff --git a/activerecord/test/models/task.rb b/activerecord/test/models/task.rb index e36989dd56..1ab1048bdb 100644 --- a/activerecord/test/models/task.rb +++ b/activerecord/test/models/task.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Task < ActiveRecord::Base def updated_at ending diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb index d9381ac9cf..a74263428b 100644 --- a/activerecord/test/models/topic.rb +++ b/activerecord/test/models/topic.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Topic < ActiveRecord::Base scope :base, -> { all } scope :written_before, lambda { |time| diff --git a/activerecord/test/models/toy.rb b/activerecord/test/models/toy.rb index ddc7048a56..97b877caea 100644 --- a/activerecord/test/models/toy.rb +++ b/activerecord/test/models/toy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Toy < ActiveRecord::Base self.primary_key = :toy_id belongs_to :pet diff --git a/activerecord/test/models/traffic_light.rb b/activerecord/test/models/traffic_light.rb index a6b7edb882..595b1cb716 100644 --- a/activerecord/test/models/traffic_light.rb +++ b/activerecord/test/models/traffic_light.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class TrafficLight < ActiveRecord::Base serialize :state, Array serialize :long_state, Array diff --git a/activerecord/test/models/treasure.rb b/activerecord/test/models/treasure.rb index fb2a5d44e2..3f2162a63d 100644 --- a/activerecord/test/models/treasure.rb +++ b/activerecord/test/models/treasure.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Treasure < ActiveRecord::Base has_and_belongs_to_many :parrots belongs_to :looter, polymorphic: true diff --git a/activerecord/test/models/treaty.rb b/activerecord/test/models/treaty.rb index 373cd48f71..a6c227c84e 100644 --- a/activerecord/test/models/treaty.rb +++ b/activerecord/test/models/treaty.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Treaty < ActiveRecord::Base self.primary_key = :treaty_id diff --git a/activerecord/test/models/tree.rb b/activerecord/test/models/tree.rb index dc29cccc9c..844c2693ec 100644 --- a/activerecord/test/models/tree.rb +++ b/activerecord/test/models/tree.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Tree < ActiveRecord::Base has_many :nodes, dependent: :destroy end diff --git a/activerecord/test/models/tuning_peg.rb b/activerecord/test/models/tuning_peg.rb index 1252d6dc1d..4fee61c565 100644 --- a/activerecord/test/models/tuning_peg.rb +++ b/activerecord/test/models/tuning_peg.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class TuningPeg < ActiveRecord::Base belongs_to :guitar validates_numericality_of :pitch diff --git a/activerecord/test/models/tyre.rb b/activerecord/test/models/tyre.rb index e50a21ca68..03ba9d3364 100644 --- a/activerecord/test/models/tyre.rb +++ b/activerecord/test/models/tyre.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Tyre < ActiveRecord::Base belongs_to :car diff --git a/activerecord/test/models/user.rb b/activerecord/test/models/user.rb index 5089a795f4..3ceacc5e7f 100644 --- a/activerecord/test/models/user.rb +++ b/activerecord/test/models/user.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "models/job" class User < ActiveRecord::Base diff --git a/activerecord/test/models/uuid_child.rb b/activerecord/test/models/uuid_child.rb index a3d0962ad6..eaa380ba20 100644 --- a/activerecord/test/models/uuid_child.rb +++ b/activerecord/test/models/uuid_child.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class UuidChild < ActiveRecord::Base belongs_to :uuid_parent end diff --git a/activerecord/test/models/uuid_item.rb b/activerecord/test/models/uuid_item.rb index 2353e40213..bb152c381a 100644 --- a/activerecord/test/models/uuid_item.rb +++ b/activerecord/test/models/uuid_item.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class UuidItem < ActiveRecord::Base end diff --git a/activerecord/test/models/uuid_parent.rb b/activerecord/test/models/uuid_parent.rb index 5634f22d0c..f654a964e0 100644 --- a/activerecord/test/models/uuid_parent.rb +++ b/activerecord/test/models/uuid_parent.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class UuidParent < ActiveRecord::Base has_many :uuid_children end diff --git a/activerecord/test/models/vegetables.rb b/activerecord/test/models/vegetables.rb index a4590d06e0..c97b6b939d 100644 --- a/activerecord/test/models/vegetables.rb +++ b/activerecord/test/models/vegetables.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Vegetable < ActiveRecord::Base validates_presence_of :name diff --git a/activerecord/test/models/vehicle.rb b/activerecord/test/models/vehicle.rb index 855bc4e325..61e18b2e40 100644 --- a/activerecord/test/models/vehicle.rb +++ b/activerecord/test/models/vehicle.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Vehicle < ActiveRecord::Base self.abstract_class = true default_scope -> { where("tires_count IS NOT NULL") } diff --git a/activerecord/test/models/vertex.rb b/activerecord/test/models/vertex.rb index 3d19433b6f..b90f71cec6 100644 --- a/activerecord/test/models/vertex.rb +++ b/activerecord/test/models/vertex.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # This class models a vertex in a directed graph. class Vertex < ActiveRecord::Base has_many :sink_edges, class_name: "Edge", foreign_key: "source_id" diff --git a/activerecord/test/models/warehouse_thing.rb b/activerecord/test/models/warehouse_thing.rb index f20bd1a245..684af49f2f 100644 --- a/activerecord/test/models/warehouse_thing.rb +++ b/activerecord/test/models/warehouse_thing.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class WarehouseThing < ActiveRecord::Base self.table_name = "warehouse-things" diff --git a/activerecord/test/models/wheel.rb b/activerecord/test/models/wheel.rb index cba2b3e518..f2fecf9545 100644 --- a/activerecord/test/models/wheel.rb +++ b/activerecord/test/models/wheel.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Wheel < ActiveRecord::Base belongs_to :wheelable, polymorphic: true, counter_cache: true end diff --git a/activerecord/test/models/without_table.rb b/activerecord/test/models/without_table.rb index 7c0fc286e1..77a471e682 100644 --- a/activerecord/test/models/without_table.rb +++ b/activerecord/test/models/without_table.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class WithoutTable < ActiveRecord::Base default_scope -> { where(published: true) } end diff --git a/activerecord/test/models/zine.rb b/activerecord/test/models/zine.rb index 3f2b348b46..4c72cbb242 100644 --- a/activerecord/test/models/zine.rb +++ b/activerecord/test/models/zine.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Zine < ActiveRecord::Base has_many :interests, inverse_of: :zine end diff --git a/activerecord/test/schema/mysql2_specific_schema.rb b/activerecord/test/schema/mysql2_specific_schema.rb index 90a314c83c..f55b030ebf 100644 --- a/activerecord/test/schema/mysql2_specific_schema.rb +++ b/activerecord/test/schema/mysql2_specific_schema.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true ActiveRecord::Schema.define do if ActiveRecord::Base.connection.version >= "5.6.0" diff --git a/activerecord/test/schema/oracle_specific_schema.rb b/activerecord/test/schema/oracle_specific_schema.rb index 264d9b8910..9129981708 100644 --- a/activerecord/test/schema/oracle_specific_schema.rb +++ b/activerecord/test/schema/oracle_specific_schema.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true ActiveRecord::Schema.define do execute "drop table test_oracle_defaults" rescue nil diff --git a/activerecord/test/schema/postgresql_specific_schema.rb b/activerecord/test/schema/postgresql_specific_schema.rb index e56e8fa36a..dbf0972b4b 100644 --- a/activerecord/test/schema/postgresql_specific_schema.rb +++ b/activerecord/test/schema/postgresql_specific_schema.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true ActiveRecord::Schema.define do enable_extension!("uuid-ossp", ActiveRecord::Base.connection) diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index f534e9c00e..d4f029ff16 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true ActiveRecord::Schema.define do # ------------------------------------------------------------------- # # # diff --git a/activerecord/test/support/config.rb b/activerecord/test/support/config.rb index aaff408b41..e385d7fff7 100644 --- a/activerecord/test/support/config.rb +++ b/activerecord/test/support/config.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "yaml" require "erb" require "fileutils" diff --git a/activerecord/test/support/connection.rb b/activerecord/test/support/connection.rb index 1a609e13c3..06a037d3d0 100644 --- a/activerecord/test/support/connection.rb +++ b/activerecord/test/support/connection.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/logger" require "models/college" require "models/course" diff --git a/activerecord/test/support/connection_helper.rb b/activerecord/test/support/connection_helper.rb index 4a19e5df44..5e37a4a991 100644 --- a/activerecord/test/support/connection_helper.rb +++ b/activerecord/test/support/connection_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ConnectionHelper def run_without_connection original_connection = ActiveRecord::Base.remove_connection diff --git a/activerecord/test/support/ddl_helper.rb b/activerecord/test/support/ddl_helper.rb index 43cb235e01..3a07316637 100644 --- a/activerecord/test/support/ddl_helper.rb +++ b/activerecord/test/support/ddl_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module DdlHelper def with_example_table(connection, table_name, definition = nil) connection.execute("CREATE TABLE #{table_name}(#{definition})") diff --git a/activerecord/test/support/schema_dumping_helper.rb b/activerecord/test/support/schema_dumping_helper.rb index 666c1b6a14..1a3f67f3ed 100644 --- a/activerecord/test/support/schema_dumping_helper.rb +++ b/activerecord/test/support/schema_dumping_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module SchemaDumpingHelper def dump_table_schema(table, connection = ActiveRecord::Base.connection) old_ignore_tables = ActiveRecord::SchemaDumper.ignore_tables -- cgit v1.2.3 From 9d4f79d3d394edb74fa2192e5d9ad7b09ce50c6d Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Fri, 30 Jun 2017 14:05:39 +0900 Subject: [Active Record] require => require_relative --- activerecord/lib/active_record.rb | 4 +- activerecord/lib/active_record/associations.rb | 2 +- .../associations/builder/collection_association.rb | 2 +- .../join_dependency/join_association.rb | 2 +- .../associations/join_dependency/join_base.rb | 2 +- .../attribute/user_provided_default.rb | 2 +- .../lib/active_record/attribute_methods/dirty.rb | 2 +- activerecord/lib/active_record/attribute_set.rb | 4 +- .../lib/active_record/attribute_set/builder.rb | 2 +- activerecord/lib/active_record/attributes.rb | 2 +- activerecord/lib/active_record/base.rb | 16 ++++---- .../abstract/schema_statements.rb | 2 +- .../connection_adapters/abstract_adapter.rb | 12 +++--- .../connection_adapters/abstract_mysql_adapter.rb | 20 +++++----- .../connection_adapters/mysql2_adapter.rb | 4 +- .../connection_adapters/postgresql/oid.rb | 44 +++++++++++----------- .../connection_adapters/postgresql_adapter.rb | 28 +++++++------- .../connection_adapters/sqlite3_adapter.rb | 16 ++++---- activerecord/lib/active_record/explain.rb | 2 +- .../lib/active_record/explain_subscriber.rb | 2 +- activerecord/lib/active_record/fixtures.rb | 4 +- .../lib/active_record/internal_metadata.rb | 4 +- activerecord/lib/active_record/railtie.rb | 10 ++--- .../active_record/railties/controller_runtime.rb | 2 +- .../lib/active_record/railties/databases.rake | 6 +-- activerecord/lib/active_record/relation/batches.rb | 2 +- .../active_record/relation/predicate_builder.rb | 16 ++++---- .../lib/active_record/relation/query_attribute.rb | 2 +- .../lib/active_record/relation/query_methods.rb | 8 ++-- .../lib/active_record/relation/spawn_methods.rb | 2 +- activerecord/lib/active_record/schema_migration.rb | 4 +- .../active_record/tasks/mysql_database_tasks.rb | 2 +- activerecord/lib/active_record/type.rb | 24 ++++++------ activerecord/lib/active_record/type_caster.rb | 4 +- activerecord/lib/active_record/validations.rb | 10 ++--- 35 files changed, 135 insertions(+), 135 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb index 29f49c6195..25d5e87317 100644 --- a/activerecord/lib/active_record.rb +++ b/activerecord/lib/active_record.rb @@ -26,8 +26,8 @@ require "active_support/rails" require "active_model" require "arel" -require "active_record/version" -require "active_record/attribute_set" +require_relative "active_record/version" +require_relative "active_record/attribute_set" module ActiveRecord extend ActiveSupport::Autoload diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index f05a122544..e782196ce6 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1,7 +1,7 @@ require "active_support/core_ext/enumerable" require "active_support/core_ext/string/conversions" require "active_support/core_ext/module/remove_method" -require "active_record/errors" +require_relative "errors" module ActiveRecord class AssociationNotFoundError < ConfigurationError #:nodoc: diff --git a/activerecord/lib/active_record/associations/builder/collection_association.rb b/activerecord/lib/active_record/associations/builder/collection_association.rb index 1fb8f76f2e..c58b7d8160 100644 --- a/activerecord/lib/active_record/associations/builder/collection_association.rb +++ b/activerecord/lib/active_record/associations/builder/collection_association.rb @@ -1,4 +1,4 @@ -require "active_record/associations" +require_relative "../../associations" module ActiveRecord::Associations::Builder # :nodoc: class CollectionAssociation < Association #:nodoc: diff --git a/activerecord/lib/active_record/associations/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/join_dependency/join_association.rb index 005410d598..d0c1848079 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb @@ -1,4 +1,4 @@ -require "active_record/associations/join_dependency/join_part" +require_relative "join_part" module ActiveRecord module Associations diff --git a/activerecord/lib/active_record/associations/join_dependency/join_base.rb b/activerecord/lib/active_record/associations/join_dependency/join_base.rb index fca20514d1..6e0963425d 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_base.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_base.rb @@ -1,4 +1,4 @@ -require "active_record/associations/join_dependency/join_part" +require_relative "join_part" module ActiveRecord module Associations diff --git a/activerecord/lib/active_record/attribute/user_provided_default.rb b/activerecord/lib/active_record/attribute/user_provided_default.rb index 57f8bbed76..c4e731fb28 100644 --- a/activerecord/lib/active_record/attribute/user_provided_default.rb +++ b/activerecord/lib/active_record/attribute/user_provided_default.rb @@ -1,4 +1,4 @@ -require "active_record/attribute" +require_relative "../attribute" module ActiveRecord class Attribute # :nodoc: diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb index 76987fb8f4..948249a6fd 100644 --- a/activerecord/lib/active_record/attribute_methods/dirty.rb +++ b/activerecord/lib/active_record/attribute_methods/dirty.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true require "active_support/core_ext/module/attribute_accessors" -require "active_record/attribute_mutation_tracker" +require_relative "../attribute_mutation_tracker" module ActiveRecord module AttributeMethods diff --git a/activerecord/lib/active_record/attribute_set.rb b/activerecord/lib/active_record/attribute_set.rb index 01f9d815d5..6399e3de70 100644 --- a/activerecord/lib/active_record/attribute_set.rb +++ b/activerecord/lib/active_record/attribute_set.rb @@ -1,5 +1,5 @@ -require "active_record/attribute_set/builder" -require "active_record/attribute_set/yaml_encoder" +require_relative "attribute_set/builder" +require_relative "attribute_set/yaml_encoder" module ActiveRecord class AttributeSet # :nodoc: diff --git a/activerecord/lib/active_record/attribute_set/builder.rb b/activerecord/lib/active_record/attribute_set/builder.rb index 2f624d32af..abe22b9ae4 100644 --- a/activerecord/lib/active_record/attribute_set/builder.rb +++ b/activerecord/lib/active_record/attribute_set/builder.rb @@ -1,4 +1,4 @@ -require "active_record/attribute" +require_relative "../attribute" module ActiveRecord class AttributeSet # :nodoc: diff --git a/activerecord/lib/active_record/attributes.rb b/activerecord/lib/active_record/attributes.rb index 475b9beec4..dde22bcdaa 100644 --- a/activerecord/lib/active_record/attributes.rb +++ b/activerecord/lib/active_record/attributes.rb @@ -1,4 +1,4 @@ -require "active_record/attribute/user_provided_default" +require_relative "attribute/user_provided_default" module ActiveRecord # See ActiveRecord::Attributes::ClassMethods for documentation diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index ac1aa2df45..f0e455478a 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -13,14 +13,14 @@ require "active_support/core_ext/kernel/singleton_class" require "active_support/core_ext/module/introspection" require "active_support/core_ext/object/duplicable" require "active_support/core_ext/class/subclasses" -require "active_record/attribute_decorators" -require "active_record/define_callbacks" -require "active_record/errors" -require "active_record/log_subscriber" -require "active_record/explain_subscriber" -require "active_record/relation/delegation" -require "active_record/attributes" -require "active_record/type_caster" +require_relative "attribute_decorators" +require_relative "define_callbacks" +require_relative "errors" +require_relative "log_subscriber" +require_relative "explain_subscriber" +require_relative "relation/delegation" +require_relative "attributes" +require_relative "type_caster" module ActiveRecord #:nodoc: # = Active Record 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 22d7791dec..7633f52a83 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -1,4 +1,4 @@ -require "active_record/migration/join_table" +require_relative "../../migration/join_table" require "active_support/core_ext/string/access" require "digest" diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 85d6fbe8b3..8f1506befa 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -1,9 +1,9 @@ -require "active_record/type" -require "active_record/connection_adapters/determine_if_preparable_visitor" -require "active_record/connection_adapters/schema_cache" -require "active_record/connection_adapters/sql_type_metadata" -require "active_record/connection_adapters/abstract/schema_dumper" -require "active_record/connection_adapters/abstract/schema_creation" +require_relative "../type" +require_relative "determine_if_preparable_visitor" +require_relative "schema_cache" +require_relative "sql_type_metadata" +require_relative "abstract/schema_dumper" +require_relative "abstract/schema_creation" require "arel/collectors/bind" require "arel/collectors/sql_string" diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index 183f0f3c1b..5cec970dca 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -1,13 +1,13 @@ -require "active_record/connection_adapters/abstract_adapter" -require "active_record/connection_adapters/statement_pool" -require "active_record/connection_adapters/mysql/column" -require "active_record/connection_adapters/mysql/explain_pretty_printer" -require "active_record/connection_adapters/mysql/quoting" -require "active_record/connection_adapters/mysql/schema_creation" -require "active_record/connection_adapters/mysql/schema_definitions" -require "active_record/connection_adapters/mysql/schema_dumper" -require "active_record/connection_adapters/mysql/schema_statements" -require "active_record/connection_adapters/mysql/type_metadata" +require_relative "abstract_adapter" +require_relative "statement_pool" +require_relative "mysql/column" +require_relative "mysql/explain_pretty_printer" +require_relative "mysql/quoting" +require_relative "mysql/schema_creation" +require_relative "mysql/schema_definitions" +require_relative "mysql/schema_dumper" +require_relative "mysql/schema_statements" +require_relative "mysql/type_metadata" require "active_support/core_ext/string/strip" diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb index af55cfe2f6..c5c0a071e7 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb @@ -1,5 +1,5 @@ -require "active_record/connection_adapters/abstract_mysql_adapter" -require "active_record/connection_adapters/mysql/database_statements" +require_relative "abstract_mysql_adapter" +require_relative "mysql/database_statements" gem "mysql2", ">= 0.3.18", "< 0.5" require "mysql2" diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb index 4098250f3e..0e8888a2b7 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb @@ -1,26 +1,26 @@ -require "active_record/connection_adapters/postgresql/oid/array" -require "active_record/connection_adapters/postgresql/oid/bit" -require "active_record/connection_adapters/postgresql/oid/bit_varying" -require "active_record/connection_adapters/postgresql/oid/bytea" -require "active_record/connection_adapters/postgresql/oid/cidr" -require "active_record/connection_adapters/postgresql/oid/date_time" -require "active_record/connection_adapters/postgresql/oid/decimal" -require "active_record/connection_adapters/postgresql/oid/enum" -require "active_record/connection_adapters/postgresql/oid/hstore" -require "active_record/connection_adapters/postgresql/oid/inet" -require "active_record/connection_adapters/postgresql/oid/json" -require "active_record/connection_adapters/postgresql/oid/jsonb" -require "active_record/connection_adapters/postgresql/oid/money" -require "active_record/connection_adapters/postgresql/oid/oid" -require "active_record/connection_adapters/postgresql/oid/point" -require "active_record/connection_adapters/postgresql/oid/legacy_point" -require "active_record/connection_adapters/postgresql/oid/range" -require "active_record/connection_adapters/postgresql/oid/specialized_string" -require "active_record/connection_adapters/postgresql/oid/uuid" -require "active_record/connection_adapters/postgresql/oid/vector" -require "active_record/connection_adapters/postgresql/oid/xml" +require_relative "oid/array" +require_relative "oid/bit" +require_relative "oid/bit_varying" +require_relative "oid/bytea" +require_relative "oid/cidr" +require_relative "oid/date_time" +require_relative "oid/decimal" +require_relative "oid/enum" +require_relative "oid/hstore" +require_relative "oid/inet" +require_relative "oid/json" +require_relative "oid/jsonb" +require_relative "oid/money" +require_relative "oid/oid" +require_relative "oid/point" +require_relative "oid/legacy_point" +require_relative "oid/range" +require_relative "oid/specialized_string" +require_relative "oid/uuid" +require_relative "oid/vector" +require_relative "oid/xml" -require "active_record/connection_adapters/postgresql/oid/type_map_initializer" +require_relative "oid/type_map_initializer" module ActiveRecord module ConnectionAdapters diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 99edbe486f..455f9b9be3 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -2,20 +2,20 @@ gem "pg", "~> 0.18" require "pg" -require "active_record/connection_adapters/abstract_adapter" -require "active_record/connection_adapters/statement_pool" -require "active_record/connection_adapters/postgresql/column" -require "active_record/connection_adapters/postgresql/database_statements" -require "active_record/connection_adapters/postgresql/explain_pretty_printer" -require "active_record/connection_adapters/postgresql/oid" -require "active_record/connection_adapters/postgresql/quoting" -require "active_record/connection_adapters/postgresql/referential_integrity" -require "active_record/connection_adapters/postgresql/schema_creation" -require "active_record/connection_adapters/postgresql/schema_definitions" -require "active_record/connection_adapters/postgresql/schema_dumper" -require "active_record/connection_adapters/postgresql/schema_statements" -require "active_record/connection_adapters/postgresql/type_metadata" -require "active_record/connection_adapters/postgresql/utils" +require_relative "abstract_adapter" +require_relative "statement_pool" +require_relative "postgresql/column" +require_relative "postgresql/database_statements" +require_relative "postgresql/explain_pretty_printer" +require_relative "postgresql/oid" +require_relative "postgresql/quoting" +require_relative "postgresql/referential_integrity" +require_relative "postgresql/schema_creation" +require_relative "postgresql/schema_definitions" +require_relative "postgresql/schema_dumper" +require_relative "postgresql/schema_statements" +require_relative "postgresql/type_metadata" +require_relative "postgresql/utils" module ActiveRecord module ConnectionHandling # :nodoc: diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index ee2faf43b5..0b38aa45f7 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -1,11 +1,11 @@ -require "active_record/connection_adapters/abstract_adapter" -require "active_record/connection_adapters/statement_pool" -require "active_record/connection_adapters/sqlite3/explain_pretty_printer" -require "active_record/connection_adapters/sqlite3/quoting" -require "active_record/connection_adapters/sqlite3/schema_creation" -require "active_record/connection_adapters/sqlite3/schema_definitions" -require "active_record/connection_adapters/sqlite3/schema_dumper" -require "active_record/connection_adapters/sqlite3/schema_statements" +require_relative "abstract_adapter" +require_relative "statement_pool" +require_relative "sqlite3/explain_pretty_printer" +require_relative "sqlite3/quoting" +require_relative "sqlite3/schema_creation" +require_relative "sqlite3/schema_definitions" +require_relative "sqlite3/schema_dumper" +require_relative "sqlite3/schema_statements" gem "sqlite3", "~> 1.3.6" require "sqlite3" diff --git a/activerecord/lib/active_record/explain.rb b/activerecord/lib/active_record/explain.rb index 8f7ae2c33c..78cbe7b2dd 100644 --- a/activerecord/lib/active_record/explain.rb +++ b/activerecord/lib/active_record/explain.rb @@ -1,4 +1,4 @@ -require "active_record/explain_registry" +require_relative "explain_registry" module ActiveRecord module Explain diff --git a/activerecord/lib/active_record/explain_subscriber.rb b/activerecord/lib/active_record/explain_subscriber.rb index abd8cfc8f2..928720d011 100644 --- a/activerecord/lib/active_record/explain_subscriber.rb +++ b/activerecord/lib/active_record/explain_subscriber.rb @@ -1,5 +1,5 @@ require "active_support/notifications" -require "active_record/explain_registry" +require_relative "explain_registry" module ActiveRecord class ExplainSubscriber # :nodoc: diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index e9acb8acae..c9e97d9d2b 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -4,8 +4,8 @@ require "zlib" require "set" require "active_support/dependencies" require "active_support/core_ext/digest/uuid" -require "active_record/fixture_set/file" -require "active_record/errors" +require_relative "fixture_set/file" +require_relative "errors" module ActiveRecord class FixtureClassNotFound < ActiveRecord::ActiveRecordError #:nodoc: diff --git a/activerecord/lib/active_record/internal_metadata.rb b/activerecord/lib/active_record/internal_metadata.rb index 25ee9d6bfe..89e5d153b8 100644 --- a/activerecord/lib/active_record/internal_metadata.rb +++ b/activerecord/lib/active_record/internal_metadata.rb @@ -1,5 +1,5 @@ -require "active_record/scoping/default" -require "active_record/scoping/named" +require_relative "scoping/default" +require_relative "scoping/named" module ActiveRecord # This class is used to create a table that keeps track of values and keys such diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 73518ca144..9cca103a18 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -48,8 +48,8 @@ module ActiveRecord # to avoid cross references when loading a constant for the # first time. Also, make it output to STDERR. console do |app| - require "active_record/railties/console_sandbox" if app.sandbox? - require "active_record/base" + require_relative "railties/console_sandbox" if app.sandbox? + require_relative "base" unless ActiveSupport::Logger.logger_outputs_to?(Rails.logger, STDERR, STDOUT) console = ActiveSupport::Logger.new(STDERR) Rails.logger.extend ActiveSupport::Logger.broadcast console @@ -57,7 +57,7 @@ module ActiveRecord end runner do - require "active_record/base" + require_relative "base" end initializer "active_record.initialize_timezone" do @@ -101,7 +101,7 @@ module ActiveRecord initializer "active_record.warn_on_records_fetched_greater_than" do if config.active_record.warn_on_records_fetched_greater_than ActiveSupport.on_load(:active_record) do - require "active_record/relation/record_fetch_warning" + require_relative "relation/record_fetch_warning" end end end @@ -139,7 +139,7 @@ end_warning # Expose database runtime to controller for logging. initializer "active_record.log_runtime" do - require "active_record/railties/controller_runtime" + require_relative "railties/controller_runtime" ActiveSupport.on_load(:action_controller) do include ActiveRecord::Railties::ControllerRuntime end diff --git a/activerecord/lib/active_record/railties/controller_runtime.rb b/activerecord/lib/active_record/railties/controller_runtime.rb index 8658188623..4030cdc158 100644 --- a/activerecord/lib/active_record/railties/controller_runtime.rb +++ b/activerecord/lib/active_record/railties/controller_runtime.rb @@ -1,5 +1,5 @@ require "active_support/core_ext/module/attr_internal" -require "active_record/log_subscriber" +require_relative "../log_subscriber" module ActiveRecord module Railties # :nodoc: diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index 711099e9e1..abc7323341 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -187,7 +187,7 @@ db_namespace = namespace :db do namespace :fixtures do desc "Loads fixtures into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z. Specify an alternative path (eg. spec/fixtures) using FIXTURES_PATH=spec/fixtures." task load: [:environment, :load_config] do - require "active_record/fixtures" + require_relative "../fixtures" base_dir = ActiveRecord::Tasks::DatabaseTasks.fixtures_path @@ -209,7 +209,7 @@ db_namespace = namespace :db do # desc "Search for a fixture given a LABEL or ID. Specify an alternative path (eg. spec/fixtures) using FIXTURES_PATH=spec/fixtures." task identify: [:environment, :load_config] do - require "active_record/fixtures" + require_relative "../fixtures" label, id = ENV["LABEL"], ENV["ID"] raise "LABEL or ID required" if label.blank? && id.blank? @@ -235,7 +235,7 @@ db_namespace = namespace :db do namespace :schema do desc "Creates a db/schema.rb file that is portable against any DB supported by Active Record" task dump: [:environment, :load_config] do - require "active_record/schema_dumper" + require_relative "../schema_dumper" filename = ENV["SCHEMA"] || File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, "schema.rb") File.open(filename, "w:utf-8") do |file| ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file) diff --git a/activerecord/lib/active_record/relation/batches.rb b/activerecord/lib/active_record/relation/batches.rb index 13a2c3f511..ee1f25ec84 100644 --- a/activerecord/lib/active_record/relation/batches.rb +++ b/activerecord/lib/active_record/relation/batches.rb @@ -1,4 +1,4 @@ -require "active_record/relation/batches/batch_enumerator" +require_relative "batches/batch_enumerator" module ActiveRecord module Batches diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index 7dea5deec5..eb80c9a00d 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -175,11 +175,11 @@ module ActiveRecord end end -require "active_record/relation/predicate_builder/array_handler" -require "active_record/relation/predicate_builder/base_handler" -require "active_record/relation/predicate_builder/basic_object_handler" -require "active_record/relation/predicate_builder/range_handler" -require "active_record/relation/predicate_builder/relation_handler" - -require "active_record/relation/predicate_builder/association_query_value" -require "active_record/relation/predicate_builder/polymorphic_array_value" +require_relative "predicate_builder/array_handler" +require_relative "predicate_builder/base_handler" +require_relative "predicate_builder/basic_object_handler" +require_relative "predicate_builder/range_handler" +require_relative "predicate_builder/relation_handler" + +require_relative "predicate_builder/association_query_value" +require_relative "predicate_builder/polymorphic_array_value" diff --git a/activerecord/lib/active_record/relation/query_attribute.rb b/activerecord/lib/active_record/relation/query_attribute.rb index a68e508fcc..0e1f64775d 100644 --- a/activerecord/lib/active_record/relation/query_attribute.rb +++ b/activerecord/lib/active_record/relation/query_attribute.rb @@ -1,4 +1,4 @@ -require "active_record/attribute" +require_relative "../attribute" module ActiveRecord class Relation diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index d44f6fd572..9da8f96337 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -1,7 +1,7 @@ -require "active_record/relation/from_clause" -require "active_record/relation/query_attribute" -require "active_record/relation/where_clause" -require "active_record/relation/where_clause_factory" +require_relative "from_clause" +require_relative "query_attribute" +require_relative "where_clause" +require_relative "where_clause_factory" require "active_model/forbidden_attributes_protection" module ActiveRecord diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb index ada89b5ec3..ddf7f825c1 100644 --- a/activerecord/lib/active_record/relation/spawn_methods.rb +++ b/activerecord/lib/active_record/relation/spawn_methods.rb @@ -1,6 +1,6 @@ require "active_support/core_ext/hash/except" require "active_support/core_ext/hash/slice" -require "active_record/relation/merger" +require_relative "merger" module ActiveRecord module SpawnMethods diff --git a/activerecord/lib/active_record/schema_migration.rb b/activerecord/lib/active_record/schema_migration.rb index f59737afb0..6dbabd69a1 100644 --- a/activerecord/lib/active_record/schema_migration.rb +++ b/activerecord/lib/active_record/schema_migration.rb @@ -1,5 +1,5 @@ -require "active_record/scoping/default" -require "active_record/scoping/named" +require_relative "scoping/default" +require_relative "scoping/named" module ActiveRecord # This class is used to create a table that keeps track of which migrations diff --git a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb index c25d87dd3e..47e13d09d8 100644 --- a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb @@ -99,7 +99,7 @@ module ActiveRecord def error_class if configuration["adapter"].include?("jdbc") - require "active_record/railties/jdbcmysql_error" + require_relative "../railties/jdbcmysql_error" ArJdbcMySQL::Error elsif defined?(Mysql2) Mysql2::Error diff --git a/activerecord/lib/active_record/type.rb b/activerecord/lib/active_record/type.rb index 9ed6c95bf9..6f4e35b159 100644 --- a/activerecord/lib/active_record/type.rb +++ b/activerecord/lib/active_record/type.rb @@ -1,20 +1,20 @@ require "active_model/type" -require "active_record/type/internal/timezone" +require_relative "type/internal/timezone" -require "active_record/type/date" -require "active_record/type/date_time" -require "active_record/type/decimal_without_scale" -require "active_record/type/json" -require "active_record/type/time" -require "active_record/type/text" -require "active_record/type/unsigned_integer" +require_relative "type/date" +require_relative "type/date_time" +require_relative "type/decimal_without_scale" +require_relative "type/json" +require_relative "type/time" +require_relative "type/text" +require_relative "type/unsigned_integer" -require "active_record/type/serialized" -require "active_record/type/adapter_specific_registry" +require_relative "type/serialized" +require_relative "type/adapter_specific_registry" -require "active_record/type/type_map" -require "active_record/type/hash_lookup_type_map" +require_relative "type/type_map" +require_relative "type/hash_lookup_type_map" module ActiveRecord module Type diff --git a/activerecord/lib/active_record/type_caster.rb b/activerecord/lib/active_record/type_caster.rb index f1686e4913..8b12a30c6a 100644 --- a/activerecord/lib/active_record/type_caster.rb +++ b/activerecord/lib/active_record/type_caster.rb @@ -1,5 +1,5 @@ -require "active_record/type_caster/map" -require "active_record/type_caster/connection" +require_relative "type_caster/map" +require_relative "type_caster/connection" module ActiveRecord module TypeCaster # :nodoc: diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index 9633f226f0..046b69bee2 100644 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -84,8 +84,8 @@ module ActiveRecord end end -require "active_record/validations/associated" -require "active_record/validations/uniqueness" -require "active_record/validations/presence" -require "active_record/validations/absence" -require "active_record/validations/length" +require_relative "validations/associated" +require_relative "validations/uniqueness" +require_relative "validations/presence" +require_relative "validations/absence" +require_relative "validations/length" -- cgit v1.2.3 From 87b3e226d65ac1ed371620bfdcd2f950c87cfece Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Sun, 2 Jul 2017 02:15:17 +0930 Subject: Revert "Merge pull request #29540 from kirs/rubocop-frozen-string" This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa. --- activerecord/Rakefile | 1 - activerecord/activerecord.gemspec | 1 - activerecord/bin/test | 1 - activerecord/examples/performance.rb | 1 - activerecord/examples/simple.rb | 1 - activerecord/lib/active_record.rb | 1 - activerecord/lib/active_record/aggregations.rb | 1 - activerecord/lib/active_record/association_relation.rb | 1 - activerecord/lib/active_record/associations.rb | 1 - .../lib/active_record/associations/alias_tracker.rb | 1 - .../lib/active_record/associations/association.rb | 1 - .../lib/active_record/associations/association_scope.rb | 1 - .../active_record/associations/belongs_to_association.rb | 1 - .../associations/belongs_to_polymorphic_association.rb | 1 - .../lib/active_record/associations/builder/association.rb | 1 - .../lib/active_record/associations/builder/belongs_to.rb | 1 - .../associations/builder/collection_association.rb | 1 - .../associations/builder/has_and_belongs_to_many.rb | 1 - .../lib/active_record/associations/builder/has_many.rb | 1 - .../lib/active_record/associations/builder/has_one.rb | 1 - .../associations/builder/singular_association.rb | 1 - .../active_record/associations/collection_association.rb | 1 - .../lib/active_record/associations/collection_proxy.rb | 1 - .../lib/active_record/associations/foreign_association.rb | 1 - .../active_record/associations/has_many_association.rb | 1 - .../associations/has_many_through_association.rb | 1 - .../lib/active_record/associations/has_one_association.rb | 1 - .../associations/has_one_through_association.rb | 1 - .../lib/active_record/associations/join_dependency.rb | 1 - .../associations/join_dependency/join_association.rb | 1 - .../associations/join_dependency/join_base.rb | 1 - .../associations/join_dependency/join_part.rb | 1 - activerecord/lib/active_record/associations/preloader.rb | 1 - .../active_record/associations/preloader/association.rb | 1 - .../active_record/associations/preloader/belongs_to.rb | 1 - .../associations/preloader/collection_association.rb | 1 - .../lib/active_record/associations/preloader/has_many.rb | 1 - .../associations/preloader/has_many_through.rb | 1 - .../lib/active_record/associations/preloader/has_one.rb | 1 - .../associations/preloader/has_one_through.rb | 1 - .../associations/preloader/singular_association.rb | 1 - .../associations/preloader/through_association.rb | 1 - .../active_record/associations/singular_association.rb | 1 - .../lib/active_record/associations/through_association.rb | 1 - activerecord/lib/active_record/attribute.rb | 1 - .../lib/active_record/attribute/user_provided_default.rb | 1 - activerecord/lib/active_record/attribute_assignment.rb | 1 - activerecord/lib/active_record/attribute_decorators.rb | 1 - activerecord/lib/active_record/attribute_methods.rb | 1 - .../active_record/attribute_methods/before_type_cast.rb | 1 - .../lib/active_record/attribute_methods/primary_key.rb | 1 - activerecord/lib/active_record/attribute_methods/query.rb | 1 - activerecord/lib/active_record/attribute_methods/read.rb | 1 - .../lib/active_record/attribute_methods/serialization.rb | 1 - .../attribute_methods/time_zone_conversion.rb | 1 - activerecord/lib/active_record/attribute_methods/write.rb | 1 - .../lib/active_record/attribute_mutation_tracker.rb | 1 - activerecord/lib/active_record/attribute_set.rb | 1 - activerecord/lib/active_record/attribute_set/builder.rb | 1 - .../lib/active_record/attribute_set/yaml_encoder.rb | 1 - activerecord/lib/active_record/attributes.rb | 1 - activerecord/lib/active_record/autosave_association.rb | 1 - activerecord/lib/active_record/base.rb | 1 - activerecord/lib/active_record/callbacks.rb | 1 - activerecord/lib/active_record/coders/json.rb | 1 - activerecord/lib/active_record/coders/yaml_column.rb | 1 - activerecord/lib/active_record/collection_cache_key.rb | 1 - .../connection_adapters/abstract/connection_pool.rb | 1 - .../connection_adapters/abstract/database_limits.rb | 1 - .../connection_adapters/abstract/database_statements.rb | 1 - .../connection_adapters/abstract/query_cache.rb | 1 - .../active_record/connection_adapters/abstract/quoting.rb | 1 - .../connection_adapters/abstract/savepoints.rb | 1 - .../connection_adapters/abstract/schema_creation.rb | 1 - .../connection_adapters/abstract/schema_definitions.rb | 1 - .../connection_adapters/abstract/schema_dumper.rb | 1 - .../connection_adapters/abstract/schema_statements.rb | 1 - .../connection_adapters/abstract/transaction.rb | 1 - .../active_record/connection_adapters/abstract_adapter.rb | 1 - .../connection_adapters/abstract_mysql_adapter.rb | 1 - .../lib/active_record/connection_adapters/column.rb | 1 - .../connection_adapters/connection_specification.rb | 1 - .../determine_if_preparable_visitor.rb | 1 - .../lib/active_record/connection_adapters/mysql/column.rb | 1 - .../connection_adapters/mysql/database_statements.rb | 1 - .../connection_adapters/mysql/explain_pretty_printer.rb | 1 - .../active_record/connection_adapters/mysql/quoting.rb | 1 - .../connection_adapters/mysql/schema_creation.rb | 1 - .../connection_adapters/mysql/schema_definitions.rb | 1 - .../connection_adapters/mysql/schema_dumper.rb | 1 - .../connection_adapters/mysql/schema_statements.rb | 1 - .../connection_adapters/mysql/type_metadata.rb | 1 - .../active_record/connection_adapters/mysql2_adapter.rb | 1 - .../connection_adapters/postgresql/column.rb | 1 - .../connection_adapters/postgresql/database_statements.rb | 1 - .../postgresql/explain_pretty_printer.rb | 1 - .../active_record/connection_adapters/postgresql/oid.rb | 1 - .../connection_adapters/postgresql/oid/array.rb | 1 - .../connection_adapters/postgresql/oid/bit.rb | 1 - .../connection_adapters/postgresql/oid/bit_varying.rb | 1 - .../connection_adapters/postgresql/oid/bytea.rb | 1 - .../connection_adapters/postgresql/oid/cidr.rb | 1 - .../connection_adapters/postgresql/oid/date_time.rb | 1 - .../connection_adapters/postgresql/oid/decimal.rb | 1 - .../connection_adapters/postgresql/oid/enum.rb | 1 - .../connection_adapters/postgresql/oid/hstore.rb | 1 - .../connection_adapters/postgresql/oid/inet.rb | 1 - .../connection_adapters/postgresql/oid/json.rb | 1 - .../connection_adapters/postgresql/oid/jsonb.rb | 1 - .../connection_adapters/postgresql/oid/legacy_point.rb | 1 - .../connection_adapters/postgresql/oid/money.rb | 1 - .../connection_adapters/postgresql/oid/oid.rb | 1 - .../connection_adapters/postgresql/oid/point.rb | 1 - .../connection_adapters/postgresql/oid/range.rb | 1 - .../postgresql/oid/specialized_string.rb | 1 - .../postgresql/oid/type_map_initializer.rb | 1 - .../connection_adapters/postgresql/oid/uuid.rb | 1 - .../connection_adapters/postgresql/oid/vector.rb | 1 - .../connection_adapters/postgresql/oid/xml.rb | 1 - .../connection_adapters/postgresql/quoting.rb | 1 - .../postgresql/referential_integrity.rb | 1 - .../connection_adapters/postgresql/schema_creation.rb | 1 - .../connection_adapters/postgresql/schema_definitions.rb | 1 - .../connection_adapters/postgresql/schema_dumper.rb | 1 - .../connection_adapters/postgresql/schema_statements.rb | 1 - .../connection_adapters/postgresql/type_metadata.rb | 1 - .../active_record/connection_adapters/postgresql/utils.rb | 1 - .../connection_adapters/postgresql_adapter.rb | 1 - .../lib/active_record/connection_adapters/schema_cache.rb | 1 - .../connection_adapters/sql_type_metadata.rb | 1 - .../connection_adapters/sqlite3/explain_pretty_printer.rb | 1 - .../active_record/connection_adapters/sqlite3/quoting.rb | 1 - .../connection_adapters/sqlite3/schema_creation.rb | 1 - .../connection_adapters/sqlite3/schema_definitions.rb | 1 - .../connection_adapters/sqlite3/schema_dumper.rb | 1 - .../connection_adapters/sqlite3/schema_statements.rb | 1 - .../active_record/connection_adapters/sqlite3_adapter.rb | 1 - .../active_record/connection_adapters/statement_pool.rb | 1 - activerecord/lib/active_record/connection_handling.rb | 1 - activerecord/lib/active_record/core.rb | 1 - activerecord/lib/active_record/counter_cache.rb | 1 - activerecord/lib/active_record/define_callbacks.rb | 1 - activerecord/lib/active_record/dynamic_matchers.rb | 1 - activerecord/lib/active_record/enum.rb | 1 - activerecord/lib/active_record/errors.rb | 1 - activerecord/lib/active_record/explain.rb | 1 - activerecord/lib/active_record/explain_registry.rb | 1 - activerecord/lib/active_record/explain_subscriber.rb | 1 - activerecord/lib/active_record/fixture_set/file.rb | 1 - activerecord/lib/active_record/fixtures.rb | 1 - activerecord/lib/active_record/gem_version.rb | 1 - activerecord/lib/active_record/inheritance.rb | 1 - activerecord/lib/active_record/integration.rb | 1 - activerecord/lib/active_record/internal_metadata.rb | 1 - activerecord/lib/active_record/legacy_yaml_adapter.rb | 1 - activerecord/lib/active_record/locking/optimistic.rb | 1 - activerecord/lib/active_record/locking/pessimistic.rb | 1 - activerecord/lib/active_record/log_subscriber.rb | 1 - activerecord/lib/active_record/migration.rb | 1 - .../lib/active_record/migration/command_recorder.rb | 1 - activerecord/lib/active_record/migration/compatibility.rb | 1 - activerecord/lib/active_record/migration/join_table.rb | 1 - activerecord/lib/active_record/model_schema.rb | 1 - activerecord/lib/active_record/nested_attributes.rb | 1 - activerecord/lib/active_record/no_touching.rb | 1 - activerecord/lib/active_record/null_relation.rb | 1 - activerecord/lib/active_record/persistence.rb | 1 - activerecord/lib/active_record/query_cache.rb | 1 - activerecord/lib/active_record/querying.rb | 1 - activerecord/lib/active_record/railtie.rb | 1 - .../lib/active_record/railties/console_sandbox.rb | 1 - .../lib/active_record/railties/controller_runtime.rb | 1 - activerecord/lib/active_record/railties/databases.rake | 1 - .../lib/active_record/railties/jdbcmysql_error.rb | 1 - activerecord/lib/active_record/readonly_attributes.rb | 1 - activerecord/lib/active_record/reflection.rb | 1 - activerecord/lib/active_record/relation.rb | 1 - activerecord/lib/active_record/relation/batches.rb | 1 - .../active_record/relation/batches/batch_enumerator.rb | 1 - activerecord/lib/active_record/relation/calculations.rb | 1 - activerecord/lib/active_record/relation/delegation.rb | 1 - activerecord/lib/active_record/relation/finder_methods.rb | 1 - activerecord/lib/active_record/relation/from_clause.rb | 1 - activerecord/lib/active_record/relation/merger.rb | 1 - .../lib/active_record/relation/predicate_builder.rb | 1 - .../relation/predicate_builder/array_handler.rb | 1 - .../relation/predicate_builder/association_query_value.rb | 1 - .../relation/predicate_builder/base_handler.rb | 1 - .../relation/predicate_builder/basic_object_handler.rb | 1 - .../relation/predicate_builder/polymorphic_array_value.rb | 1 - .../relation/predicate_builder/range_handler.rb | 1 - .../relation/predicate_builder/relation_handler.rb | 1 - .../lib/active_record/relation/query_attribute.rb | 1 - activerecord/lib/active_record/relation/query_methods.rb | 1 - .../lib/active_record/relation/record_fetch_warning.rb | 1 - activerecord/lib/active_record/relation/spawn_methods.rb | 1 - activerecord/lib/active_record/relation/where_clause.rb | 1 - .../lib/active_record/relation/where_clause_factory.rb | 1 - activerecord/lib/active_record/result.rb | 1 - activerecord/lib/active_record/runtime_registry.rb | 1 - activerecord/lib/active_record/sanitization.rb | 1 - activerecord/lib/active_record/schema.rb | 1 - activerecord/lib/active_record/schema_dumper.rb | 1 - activerecord/lib/active_record/schema_migration.rb | 1 - activerecord/lib/active_record/scoping.rb | 1 - activerecord/lib/active_record/scoping/default.rb | 1 - activerecord/lib/active_record/scoping/named.rb | 1 - activerecord/lib/active_record/secure_token.rb | 1 - activerecord/lib/active_record/serialization.rb | 1 - activerecord/lib/active_record/statement_cache.rb | 1 - activerecord/lib/active_record/store.rb | 1 - activerecord/lib/active_record/suppressor.rb | 1 - activerecord/lib/active_record/table_metadata.rb | 1 - activerecord/lib/active_record/tasks/database_tasks.rb | 1 - .../lib/active_record/tasks/mysql_database_tasks.rb | 1 - .../lib/active_record/tasks/postgresql_database_tasks.rb | 1 - .../lib/active_record/tasks/sqlite_database_tasks.rb | 1 - activerecord/lib/active_record/touch_later.rb | 1 - activerecord/lib/active_record/transactions.rb | 1 - activerecord/lib/active_record/translation.rb | 1 - activerecord/lib/active_record/type.rb | 1 - .../lib/active_record/type/adapter_specific_registry.rb | 1 - activerecord/lib/active_record/type/date.rb | 1 - activerecord/lib/active_record/type/date_time.rb | 1 - .../lib/active_record/type/decimal_without_scale.rb | 1 - .../lib/active_record/type/hash_lookup_type_map.rb | 1 - activerecord/lib/active_record/type/internal/timezone.rb | 1 - activerecord/lib/active_record/type/json.rb | 1 - activerecord/lib/active_record/type/serialized.rb | 1 - activerecord/lib/active_record/type/text.rb | 1 - activerecord/lib/active_record/type/time.rb | 1 - activerecord/lib/active_record/type/type_map.rb | 1 - activerecord/lib/active_record/type/unsigned_integer.rb | 1 - activerecord/lib/active_record/type_caster.rb | 1 - activerecord/lib/active_record/type_caster/connection.rb | 1 - activerecord/lib/active_record/type_caster/map.rb | 1 - activerecord/lib/active_record/validations.rb | 1 - activerecord/lib/active_record/validations/absence.rb | 1 - activerecord/lib/active_record/validations/associated.rb | 1 - activerecord/lib/active_record/validations/length.rb | 1 - activerecord/lib/active_record/validations/presence.rb | 1 - activerecord/lib/active_record/validations/uniqueness.rb | 1 - activerecord/lib/active_record/version.rb | 1 - activerecord/lib/rails/generators/active_record.rb | 1 - .../lib/rails/generators/active_record/migration.rb | 1 - .../active_record/migration/migration_generator.rb | 1 - .../generators/active_record/model/model_generator.rb | 1 - .../active_record/connection_adapters/fake_adapter.rb | 1 - activerecord/test/cases/adapter_test.rb | 1 - .../test/cases/adapters/mysql2/active_schema_test.rb | 1 - .../test/cases/adapters/mysql2/bind_parameter_test.rb | 1 - activerecord/test/cases/adapters/mysql2/boolean_test.rb | 1 - .../test/cases/adapters/mysql2/case_sensitivity_test.rb | 1 - .../test/cases/adapters/mysql2/charset_collation_test.rb | 1 - .../test/cases/adapters/mysql2/connection_test.rb | 1 - .../adapters/mysql2/datetime_precision_quoting_test.rb | 1 - activerecord/test/cases/adapters/mysql2/enum_test.rb | 1 - activerecord/test/cases/adapters/mysql2/explain_test.rb | 1 - activerecord/test/cases/adapters/mysql2/json_test.rb | 1 - .../test/cases/adapters/mysql2/mysql2_adapter_test.rb | 1 - .../test/cases/adapters/mysql2/schema_migrations_test.rb | 1 - activerecord/test/cases/adapters/mysql2/schema_test.rb | 1 - activerecord/test/cases/adapters/mysql2/sp_test.rb | 1 - activerecord/test/cases/adapters/mysql2/sql_types_test.rb | 1 - .../test/cases/adapters/mysql2/table_options_test.rb | 1 - .../test/cases/adapters/mysql2/transaction_test.rb | 1 - .../test/cases/adapters/mysql2/unsigned_type_test.rb | 1 - .../test/cases/adapters/mysql2/virtual_column_test.rb | 1 - .../test/cases/adapters/postgresql/active_schema_test.rb | 1 - activerecord/test/cases/adapters/postgresql/array_test.rb | 1 - .../test/cases/adapters/postgresql/bit_string_test.rb | 1 - activerecord/test/cases/adapters/postgresql/bytea_test.rb | 1 - .../cases/adapters/postgresql/case_insensitive_test.rb | 1 - .../test/cases/adapters/postgresql/change_schema_test.rb | 1 - activerecord/test/cases/adapters/postgresql/cidr_test.rb | 1 - .../test/cases/adapters/postgresql/citext_test.rb | 1 - .../test/cases/adapters/postgresql/collation_test.rb | 1 - .../test/cases/adapters/postgresql/composite_test.rb | 1 - .../test/cases/adapters/postgresql/connection_test.rb | 1 - .../test/cases/adapters/postgresql/datatype_test.rb | 1 - .../test/cases/adapters/postgresql/domain_test.rb | 1 - activerecord/test/cases/adapters/postgresql/enum_test.rb | 1 - .../test/cases/adapters/postgresql/explain_test.rb | 1 - .../cases/adapters/postgresql/extension_migration_test.rb | 1 - .../test/cases/adapters/postgresql/full_text_test.rb | 1 - .../test/cases/adapters/postgresql/geometric_test.rb | 1 - .../test/cases/adapters/postgresql/hstore_test.rb | 1 - .../test/cases/adapters/postgresql/infinity_test.rb | 1 - .../test/cases/adapters/postgresql/integer_test.rb | 1 - activerecord/test/cases/adapters/postgresql/json_test.rb | 1 - activerecord/test/cases/adapters/postgresql/ltree_test.rb | 1 - activerecord/test/cases/adapters/postgresql/money_test.rb | 1 - .../test/cases/adapters/postgresql/network_test.rb | 1 - .../test/cases/adapters/postgresql/numbers_test.rb | 1 - .../cases/adapters/postgresql/postgresql_adapter_test.rb | 1 - .../postgresql/prepared_statements_disabled_test.rb | 1 - .../test/cases/adapters/postgresql/quoting_test.rb | 1 - activerecord/test/cases/adapters/postgresql/range_test.rb | 1 - .../adapters/postgresql/referential_integrity_test.rb | 1 - .../test/cases/adapters/postgresql/rename_table_test.rb | 1 - .../adapters/postgresql/schema_authorization_test.rb | 1 - .../test/cases/adapters/postgresql/schema_test.rb | 1 - .../test/cases/adapters/postgresql/serial_test.rb | 1 - .../test/cases/adapters/postgresql/statement_pool_test.rb | 1 - .../test/cases/adapters/postgresql/timestamp_test.rb | 1 - .../test/cases/adapters/postgresql/transaction_test.rb | 1 - .../test/cases/adapters/postgresql/type_lookup_test.rb | 1 - activerecord/test/cases/adapters/postgresql/utils_test.rb | 1 - activerecord/test/cases/adapters/postgresql/uuid_test.rb | 1 - activerecord/test/cases/adapters/postgresql/xml_test.rb | 1 - .../test/cases/adapters/sqlite3/collation_test.rb | 1 - .../test/cases/adapters/sqlite3/copy_table_test.rb | 1 - activerecord/test/cases/adapters/sqlite3/explain_test.rb | 1 - activerecord/test/cases/adapters/sqlite3/quoting_test.rb | 1 - .../test/cases/adapters/sqlite3/sqlite3_adapter_test.rb | 1 - .../cases/adapters/sqlite3/sqlite3_create_folder_test.rb | 1 - .../test/cases/adapters/sqlite3/statement_pool_test.rb | 1 - activerecord/test/cases/aggregations_test.rb | 1 - activerecord/test/cases/ar_schema_test.rb | 1 - .../test/cases/associations/association_scope_test.rb | 1 - .../cases/associations/belongs_to_associations_test.rb | 1 - .../bidirectional_destroy_dependencies_test.rb | 1 - activerecord/test/cases/associations/callbacks_test.rb | 1 - .../cases/associations/cascaded_eager_loading_test.rb | 1 - .../eager_load_includes_full_sti_class_test.rb | 1 - .../cases/associations/eager_load_nested_include_test.rb | 1 - .../test/cases/associations/eager_singularization_test.rb | 1 - activerecord/test/cases/associations/eager_test.rb | 1 - activerecord/test/cases/associations/extension_test.rb | 1 - .../has_and_belongs_to_many_associations_test.rb | 1 - .../test/cases/associations/has_many_associations_test.rb | 1 - .../associations/has_many_through_associations_test.rb | 1 - .../test/cases/associations/has_one_associations_test.rb | 1 - .../associations/has_one_through_associations_test.rb | 1 - .../cases/associations/inner_join_association_test.rb | 1 - .../test/cases/associations/inverse_associations_test.rb | 1 - activerecord/test/cases/associations/join_model_test.rb | 1 - .../associations/left_outer_join_association_test.rb | 1 - .../associations/nested_through_associations_test.rb | 1 - activerecord/test/cases/associations/required_test.rb | 1 - activerecord/test/cases/associations_test.rb | 1 - activerecord/test/cases/attribute_decorators_test.rb | 1 - activerecord/test/cases/attribute_methods/read_test.rb | 1 - activerecord/test/cases/attribute_methods_test.rb | 1 - activerecord/test/cases/attribute_set_test.rb | 1 - activerecord/test/cases/attribute_test.rb | 1 - activerecord/test/cases/attributes_test.rb | 1 - activerecord/test/cases/autosave_association_test.rb | 1 - activerecord/test/cases/base_test.rb | 1 - activerecord/test/cases/batches_test.rb | 1 - activerecord/test/cases/binary_test.rb | 1 - activerecord/test/cases/bind_parameter_test.rb | 1 - activerecord/test/cases/cache_key_test.rb | 1 - activerecord/test/cases/calculations_test.rb | 1 - activerecord/test/cases/callbacks_test.rb | 1 - activerecord/test/cases/clone_test.rb | 1 - activerecord/test/cases/coders/json_test.rb | 1 - activerecord/test/cases/coders/yaml_column_test.rb | 1 - activerecord/test/cases/collection_cache_key_test.rb | 1 - activerecord/test/cases/column_alias_test.rb | 1 - activerecord/test/cases/column_definition_test.rb | 1 - activerecord/test/cases/comment_test.rb | 1 - .../cases/connection_adapters/adapter_leasing_test.rb | 1 - .../cases/connection_adapters/connection_handler_test.rb | 1 - .../connection_adapters/connection_specification_test.rb | 1 - .../merge_and_resolve_default_url_config_test.rb | 1 - .../cases/connection_adapters/mysql_type_lookup_test.rb | 1 - .../test/cases/connection_adapters/schema_cache_test.rb | 1 - .../test/cases/connection_adapters/type_lookup_test.rb | 1 - activerecord/test/cases/connection_management_test.rb | 1 - activerecord/test/cases/connection_pool_test.rb | 1 - .../test/cases/connection_specification/resolver_test.rb | 1 - activerecord/test/cases/core_test.rb | 1 - activerecord/test/cases/counter_cache_test.rb | 1 - activerecord/test/cases/custom_locking_test.rb | 1 - activerecord/test/cases/database_statements_test.rb | 1 - activerecord/test/cases/date_test.rb | 1 - activerecord/test/cases/date_time_precision_test.rb | 1 - activerecord/test/cases/date_time_test.rb | 1 - activerecord/test/cases/defaults_test.rb | 1 - activerecord/test/cases/dirty_test.rb | 1 - activerecord/test/cases/disconnected_test.rb | 1 - activerecord/test/cases/dup_test.rb | 1 - activerecord/test/cases/enum_test.rb | 1 - activerecord/test/cases/errors_test.rb | 1 - activerecord/test/cases/explain_subscriber_test.rb | 1 - activerecord/test/cases/explain_test.rb | 1 - activerecord/test/cases/finder_respond_to_test.rb | 1 - activerecord/test/cases/finder_test.rb | 1 - activerecord/test/cases/fixture_set/file_test.rb | 1 - activerecord/test/cases/fixtures_test.rb | 1 - .../test/cases/forbidden_attributes_protection_test.rb | 1 - activerecord/test/cases/habtm_destroy_order_test.rb | 1 - activerecord/test/cases/helper.rb | 1 - activerecord/test/cases/hot_compatibility_test.rb | 1 - activerecord/test/cases/i18n_test.rb | 1 - activerecord/test/cases/inheritance_test.rb | 1 - activerecord/test/cases/integration_test.rb | 1 - activerecord/test/cases/invalid_connection_test.rb | 1 - activerecord/test/cases/invertible_migration_test.rb | 1 - activerecord/test/cases/json_attribute_test.rb | 1 - activerecord/test/cases/json_serialization_test.rb | 1 - activerecord/test/cases/json_shared_test_cases.rb | 1 - activerecord/test/cases/locking_test.rb | 1 - activerecord/test/cases/log_subscriber_test.rb | 1 - activerecord/test/cases/migration/change_schema_test.rb | 1 - activerecord/test/cases/migration/change_table_test.rb | 1 - .../test/cases/migration/column_attributes_test.rb | 1 - .../test/cases/migration/column_positioning_test.rb | 1 - activerecord/test/cases/migration/columns_test.rb | 1 - .../test/cases/migration/command_recorder_test.rb | 1 - activerecord/test/cases/migration/compatibility_test.rb | 1 - .../test/cases/migration/create_join_table_test.rb | 1 - activerecord/test/cases/migration/foreign_key_test.rb | 1 - activerecord/test/cases/migration/helper.rb | 1 - activerecord/test/cases/migration/index_test.rb | 1 - activerecord/test/cases/migration/logger_test.rb | 1 - .../test/cases/migration/pending_migrations_test.rb | 1 - .../test/cases/migration/references_foreign_key_test.rb | 1 - .../test/cases/migration/references_index_test.rb | 1 - .../test/cases/migration/references_statements_test.rb | 1 - activerecord/test/cases/migration/rename_table_test.rb | 1 - activerecord/test/cases/migration_test.rb | 1 - activerecord/test/cases/migrator_test.rb | 1 - activerecord/test/cases/mixin_test.rb | 1 - activerecord/test/cases/modules_test.rb | 1 - activerecord/test/cases/multiparameter_attributes_test.rb | 1 - activerecord/test/cases/multiple_db_test.rb | 1 - activerecord/test/cases/nested_attributes_test.rb | 1 - .../test/cases/nested_attributes_with_callbacks_test.rb | 1 - activerecord/test/cases/numeric_data_test.rb | 1 - activerecord/test/cases/persistence_test.rb | 1 - activerecord/test/cases/pooled_connections_test.rb | 1 - activerecord/test/cases/primary_keys_test.rb | 1 - activerecord/test/cases/query_cache_test.rb | 1 - activerecord/test/cases/quoting_test.rb | 1 - activerecord/test/cases/readonly_test.rb | 1 - activerecord/test/cases/reaper_test.rb | 1 - activerecord/test/cases/reflection_test.rb | 1 - activerecord/test/cases/relation/delegation_test.rb | 1 - activerecord/test/cases/relation/merging_test.rb | 1 - activerecord/test/cases/relation/mutation_test.rb | 1 - activerecord/test/cases/relation/or_test.rb | 1 - .../test/cases/relation/predicate_builder_test.rb | 1 - .../test/cases/relation/record_fetch_warning_test.rb | 1 - activerecord/test/cases/relation/where_chain_test.rb | 1 - activerecord/test/cases/relation/where_clause_test.rb | 1 - activerecord/test/cases/relation/where_test.rb | 1 - activerecord/test/cases/relation_test.rb | 1 - activerecord/test/cases/relations_test.rb | 1 - activerecord/test/cases/reload_models_test.rb | 1 - activerecord/test/cases/reserved_word_test.rb | 1 - activerecord/test/cases/result_test.rb | 1 - activerecord/test/cases/sanitize_test.rb | 1 - activerecord/test/cases/schema_dumper_test.rb | 1 - activerecord/test/cases/schema_loading_test.rb | 1 - activerecord/test/cases/scoping/default_scoping_test.rb | 1 - activerecord/test/cases/scoping/named_scoping_test.rb | 1 - activerecord/test/cases/scoping/relation_scoping_test.rb | 1 - activerecord/test/cases/secure_token_test.rb | 1 - activerecord/test/cases/serialization_test.rb | 1 - activerecord/test/cases/serialized_attribute_test.rb | 1 - activerecord/test/cases/statement_cache_test.rb | 1 - activerecord/test/cases/store_test.rb | 1 - activerecord/test/cases/suppressor_test.rb | 1 - activerecord/test/cases/tasks/database_tasks_test.rb | 1 - activerecord/test/cases/tasks/mysql_rake_test.rb | 1 - activerecord/test/cases/tasks/postgresql_rake_test.rb | 1 - activerecord/test/cases/tasks/sqlite_rake_test.rb | 1 - activerecord/test/cases/test_case.rb | 1 - activerecord/test/cases/test_fixtures_test.rb | 1 - activerecord/test/cases/time_precision_test.rb | 1 - activerecord/test/cases/timestamp_test.rb | 1 - activerecord/test/cases/touch_later_test.rb | 1 - activerecord/test/cases/transaction_callbacks_test.rb | 1 - activerecord/test/cases/transaction_isolation_test.rb | 1 - activerecord/test/cases/transactions_test.rb | 1 - .../test/cases/type/adapter_specific_registry_test.rb | 1 - activerecord/test/cases/type/date_time_test.rb | 1 - activerecord/test/cases/type/integer_test.rb | 1 - activerecord/test/cases/type/string_test.rb | 1 - activerecord/test/cases/type/type_map_test.rb | 1 - activerecord/test/cases/type/unsigned_integer_test.rb | 1 - activerecord/test/cases/type_test.rb | 1 - activerecord/test/cases/types_test.rb | 1 - activerecord/test/cases/unconnected_test.rb | 1 - .../test/cases/validations/absence_validation_test.rb | 1 - .../test/cases/validations/association_validation_test.rb | 1 - .../validations/i18n_generate_message_validation_test.rb | 1 - .../test/cases/validations/i18n_validation_test.rb | 1 - .../test/cases/validations/length_validation_test.rb | 1 - .../test/cases/validations/presence_validation_test.rb | 1 - .../test/cases/validations/uniqueness_validation_test.rb | 1 - activerecord/test/cases/validations_repair_helper.rb | 1 - activerecord/test/cases/validations_test.rb | 1 - activerecord/test/cases/view_test.rb | 1 - activerecord/test/cases/yaml_serialization_test.rb | 1 - activerecord/test/config.rb | 1 - .../test/migrations/10_urban/9_add_expressions.rb | 1 - .../test/migrations/decimal/1_give_me_big_numbers.rb | 1 - .../test/migrations/magic/1_currencies_have_symbols.rb | 5 ++--- .../migrations/missing/1000_people_have_middle_names.rb | 1 - .../test/migrations/missing/1_people_have_last_names.rb | 1 - .../test/migrations/missing/3_we_need_reminders.rb | 1 - .../test/migrations/missing/4_innocent_jointable.rb | 1 - activerecord/test/migrations/rename/1_we_need_things.rb | 1 - activerecord/test/migrations/rename/2_rename_things.rb | 1 - .../test/migrations/to_copy/1_people_have_hobbies.rb | 1 - .../test/migrations/to_copy/2_people_have_descriptions.rb | 1 - .../test/migrations/to_copy2/1_create_articles.rb | 1 - .../test/migrations/to_copy2/2_create_comments.rb | 1 - .../to_copy_with_name_collision/1_people_have_hobbies.rb | 1 - .../20090101010101_people_have_hobbies.rb | 1 - .../20090101010202_people_have_descriptions.rb | 1 - .../20090101010101_create_articles.rb | 1 - .../20090101010202_create_comments.rb | 1 - .../migrations/valid/1_valid_people_have_last_names.rb | 1 - activerecord/test/migrations/valid/2_we_need_reminders.rb | 1 - .../test/migrations/valid/3_innocent_jointable.rb | 1 - .../1_valid_people_have_last_names.rb | 1 - .../valid_with_subdirectories/sub/2_we_need_reminders.rb | 1 - .../sub1/3_innocent_jointable.rb | 1 - ...010101_valid_with_timestamps_people_have_last_names.rb | 1 - ...00201010101_valid_with_timestamps_we_need_reminders.rb | 1 - ...0301010101_valid_with_timestamps_innocent_jointable.rb | 1 - .../20131219224947_migration_version_check.rb | 1 - activerecord/test/models/admin.rb | 1 - activerecord/test/models/admin/account.rb | 1 - activerecord/test/models/admin/randomly_named_c1.rb | 15 +++++++-------- activerecord/test/models/admin/user.rb | 1 - activerecord/test/models/aircraft.rb | 1 - activerecord/test/models/arunit2_model.rb | 1 - activerecord/test/models/author.rb | 1 - activerecord/test/models/auto_id.rb | 1 - activerecord/test/models/autoloadable/extra_firm.rb | 1 - activerecord/test/models/binary.rb | 1 - activerecord/test/models/bird.rb | 1 - activerecord/test/models/book.rb | 1 - activerecord/test/models/boolean.rb | 1 - activerecord/test/models/bulb.rb | 1 - activerecord/test/models/cake_designer.rb | 1 - activerecord/test/models/car.rb | 1 - activerecord/test/models/carrier.rb | 1 - activerecord/test/models/cat.rb | 1 - activerecord/test/models/categorization.rb | 1 - activerecord/test/models/category.rb | 1 - activerecord/test/models/chef.rb | 1 - activerecord/test/models/citation.rb | 1 - activerecord/test/models/club.rb | 1 - activerecord/test/models/college.rb | 1 - activerecord/test/models/column.rb | 1 - activerecord/test/models/column_name.rb | 1 - activerecord/test/models/comment.rb | 1 - activerecord/test/models/company.rb | 1 - activerecord/test/models/company_in_module.rb | 1 - activerecord/test/models/computer.rb | 1 - activerecord/test/models/contact.rb | 1 - activerecord/test/models/content.rb | 1 - activerecord/test/models/contract.rb | 1 - activerecord/test/models/country.rb | 1 - activerecord/test/models/course.rb | 1 - activerecord/test/models/customer.rb | 1 - activerecord/test/models/customer_carrier.rb | 1 - activerecord/test/models/dashboard.rb | 1 - activerecord/test/models/default.rb | 1 - activerecord/test/models/department.rb | 1 - activerecord/test/models/developer.rb | 1 - activerecord/test/models/dog.rb | 1 - activerecord/test/models/dog_lover.rb | 1 - activerecord/test/models/doubloon.rb | 1 - activerecord/test/models/drink_designer.rb | 1 - activerecord/test/models/edge.rb | 1 - activerecord/test/models/electron.rb | 1 - activerecord/test/models/engine.rb | 1 - activerecord/test/models/entrant.rb | 1 - activerecord/test/models/essay.rb | 1 - activerecord/test/models/event.rb | 1 - activerecord/test/models/eye.rb | 1 - activerecord/test/models/face.rb | 1 - activerecord/test/models/family.rb | 1 - activerecord/test/models/family_tree.rb | 1 - activerecord/test/models/friendship.rb | 1 - activerecord/test/models/guid.rb | 1 - activerecord/test/models/guitar.rb | 1 - activerecord/test/models/hotel.rb | 1 - activerecord/test/models/image.rb | 1 - activerecord/test/models/interest.rb | 1 - activerecord/test/models/invoice.rb | 1 - activerecord/test/models/item.rb | 1 - activerecord/test/models/job.rb | 1 - activerecord/test/models/joke.rb | 1 - activerecord/test/models/keyboard.rb | 1 - activerecord/test/models/legacy_thing.rb | 1 - activerecord/test/models/lesson.rb | 1 - activerecord/test/models/line_item.rb | 1 - activerecord/test/models/liquid.rb | 1 - activerecord/test/models/man.rb | 1 - activerecord/test/models/matey.rb | 1 - activerecord/test/models/member.rb | 1 - activerecord/test/models/member_detail.rb | 1 - activerecord/test/models/member_type.rb | 1 - activerecord/test/models/membership.rb | 1 - activerecord/test/models/mentor.rb | 1 - activerecord/test/models/minimalistic.rb | 1 - activerecord/test/models/minivan.rb | 1 - activerecord/test/models/mixed_case_monkey.rb | 1 - activerecord/test/models/mocktail_designer.rb | 1 - activerecord/test/models/molecule.rb | 1 - activerecord/test/models/movie.rb | 1 - activerecord/test/models/node.rb | 1 - activerecord/test/models/non_primary_key.rb | 1 - activerecord/test/models/notification.rb | 1 - activerecord/test/models/numeric_data.rb | 1 - activerecord/test/models/order.rb | 1 - activerecord/test/models/organization.rb | 1 - activerecord/test/models/other_dog.rb | 1 - activerecord/test/models/owner.rb | 1 - activerecord/test/models/parrot.rb | 1 - activerecord/test/models/person.rb | 1 - activerecord/test/models/personal_legacy_thing.rb | 1 - activerecord/test/models/pet.rb | 1 - activerecord/test/models/pet_treasure.rb | 1 - activerecord/test/models/pirate.rb | 1 - activerecord/test/models/possession.rb | 1 - activerecord/test/models/post.rb | 1 - activerecord/test/models/price_estimate.rb | 1 - activerecord/test/models/professor.rb | 1 - activerecord/test/models/project.rb | 1 - activerecord/test/models/publisher.rb | 1 - activerecord/test/models/publisher/article.rb | 1 - activerecord/test/models/publisher/magazine.rb | 1 - activerecord/test/models/randomly_named_c1.rb | 7 +++---- activerecord/test/models/rating.rb | 1 - activerecord/test/models/reader.rb | 1 - activerecord/test/models/recipe.rb | 1 - activerecord/test/models/record.rb | 1 - activerecord/test/models/reference.rb | 1 - activerecord/test/models/reply.rb | 1 - activerecord/test/models/ship.rb | 1 - activerecord/test/models/ship_part.rb | 1 - activerecord/test/models/shop.rb | 1 - activerecord/test/models/shop_account.rb | 1 - activerecord/test/models/speedometer.rb | 1 - activerecord/test/models/sponsor.rb | 1 - activerecord/test/models/string_key_object.rb | 1 - activerecord/test/models/student.rb | 1 - activerecord/test/models/subscriber.rb | 1 - activerecord/test/models/subscription.rb | 1 - activerecord/test/models/tag.rb | 1 - activerecord/test/models/tagging.rb | 1 - activerecord/test/models/task.rb | 1 - activerecord/test/models/topic.rb | 1 - activerecord/test/models/toy.rb | 1 - activerecord/test/models/traffic_light.rb | 1 - activerecord/test/models/treasure.rb | 1 - activerecord/test/models/treaty.rb | 1 - activerecord/test/models/tree.rb | 1 - activerecord/test/models/tuning_peg.rb | 1 - activerecord/test/models/tyre.rb | 1 - activerecord/test/models/user.rb | 1 - activerecord/test/models/uuid_child.rb | 1 - activerecord/test/models/uuid_item.rb | 1 - activerecord/test/models/uuid_parent.rb | 1 - activerecord/test/models/vegetables.rb | 1 - activerecord/test/models/vehicle.rb | 1 - activerecord/test/models/vertex.rb | 1 - activerecord/test/models/warehouse_thing.rb | 1 - activerecord/test/models/wheel.rb | 1 - activerecord/test/models/without_table.rb | 1 - activerecord/test/models/zine.rb | 1 - activerecord/test/schema/mysql2_specific_schema.rb | 1 - activerecord/test/schema/oracle_specific_schema.rb | 1 - activerecord/test/schema/postgresql_specific_schema.rb | 1 - activerecord/test/schema/schema.rb | 1 - activerecord/test/support/config.rb | 1 - activerecord/test/support/connection.rb | 1 - activerecord/test/support/connection_helper.rb | 1 - activerecord/test/support/ddl_helper.rb | 1 - activerecord/test/support/schema_dumping_helper.rb | 1 - 679 files changed, 12 insertions(+), 691 deletions(-) (limited to 'activerecord') diff --git a/activerecord/Rakefile b/activerecord/Rakefile index 4347071693..fe5f9d1071 100644 --- a/activerecord/Rakefile +++ b/activerecord/Rakefile @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "rake/testtask" require_relative "test/config" diff --git a/activerecord/activerecord.gemspec b/activerecord/activerecord.gemspec index b28cb0c2f7..a626a1f21b 100644 --- a/activerecord/activerecord.gemspec +++ b/activerecord/activerecord.gemspec @@ -1,4 +1,3 @@ -# frozen_string_literal: true version = File.read(File.expand_path("../RAILS_VERSION", __dir__)).strip Gem::Specification.new do |s| diff --git a/activerecord/bin/test b/activerecord/bin/test index 83c192531e..ab69f4f603 100755 --- a/activerecord/bin/test +++ b/activerecord/bin/test @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -# frozen_string_literal: true COMPONENT_ROOT = File.expand_path("..", __dir__) require_relative "../../tools/test" diff --git a/activerecord/examples/performance.rb b/activerecord/examples/performance.rb index 74e5ffd976..3257dd4ad7 100644 --- a/activerecord/examples/performance.rb +++ b/activerecord/examples/performance.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record" require "benchmark/ips" diff --git a/activerecord/examples/simple.rb b/activerecord/examples/simple.rb index 6b9bc781d1..c3648fee48 100644 --- a/activerecord/examples/simple.rb +++ b/activerecord/examples/simple.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record" class Person < ActiveRecord::Base diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb index 11300da52a..29f49c6195 100644 --- a/activerecord/lib/active_record.rb +++ b/activerecord/lib/active_record.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true #-- # Copyright (c) 2004-2017 David Heinemeier Hansson # diff --git a/activerecord/lib/active_record/aggregations.rb b/activerecord/lib/active_record/aggregations.rb index e0caad5381..10cbd5429c 100644 --- a/activerecord/lib/active_record/aggregations.rb +++ b/activerecord/lib/active_record/aggregations.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # See ActiveRecord::Aggregations::ClassMethods for documentation module Aggregations diff --git a/activerecord/lib/active_record/association_relation.rb b/activerecord/lib/active_record/association_relation.rb index a79112cb3b..de2d03cd0b 100644 --- a/activerecord/lib/active_record/association_relation.rb +++ b/activerecord/lib/active_record/association_relation.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class AssociationRelation < Relation def initialize(klass, table, predicate_builder, association) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 13db82b2aa..f05a122544 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/enumerable" require "active_support/core_ext/string/conversions" require "active_support/core_ext/module/remove_method" diff --git a/activerecord/lib/active_record/associations/alias_tracker.rb b/activerecord/lib/active_record/associations/alias_tracker.rb index eb81ba5ff6..104de4f69d 100644 --- a/activerecord/lib/active_record/associations/alias_tracker.rb +++ b/activerecord/lib/active_record/associations/alias_tracker.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/string/conversions" module ActiveRecord diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb index 0fca4467f9..1138ae3462 100644 --- a/activerecord/lib/active_record/associations/association.rb +++ b/activerecord/lib/active_record/associations/association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/array/wrap" module ActiveRecord diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb index 900ebda2bb..6ef225b725 100644 --- a/activerecord/lib/active_record/associations/association_scope.rb +++ b/activerecord/lib/active_record/associations/association_scope.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Associations class AssociationScope #:nodoc: diff --git a/activerecord/lib/active_record/associations/belongs_to_association.rb b/activerecord/lib/active_record/associations/belongs_to_association.rb index b8d3173dc7..0e61dbfb00 100644 --- a/activerecord/lib/active_record/associations/belongs_to_association.rb +++ b/activerecord/lib/active_record/associations/belongs_to_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record Belongs To Association module Associations diff --git a/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb b/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb index 15aae53e80..b710cf6bdb 100644 --- a/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +++ b/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record Belongs To Polymorphic Association module Associations diff --git a/activerecord/lib/active_record/associations/builder/association.rb b/activerecord/lib/active_record/associations/builder/association.rb index df8d77a5d1..d0534056d9 100644 --- a/activerecord/lib/active_record/associations/builder/association.rb +++ b/activerecord/lib/active_record/associations/builder/association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true # This is the parent Association class which defines the variables # used by all associations. # diff --git a/activerecord/lib/active_record/associations/builder/belongs_to.rb b/activerecord/lib/active_record/associations/builder/belongs_to.rb index 7c2cc61ecd..2b9dd8aae8 100644 --- a/activerecord/lib/active_record/associations/builder/belongs_to.rb +++ b/activerecord/lib/active_record/associations/builder/belongs_to.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord::Associations::Builder # :nodoc: class BelongsTo < SingularAssociation #:nodoc: def self.macro diff --git a/activerecord/lib/active_record/associations/builder/collection_association.rb b/activerecord/lib/active_record/associations/builder/collection_association.rb index f6e471feca..1fb8f76f2e 100644 --- a/activerecord/lib/active_record/associations/builder/collection_association.rb +++ b/activerecord/lib/active_record/associations/builder/collection_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/associations" module ActiveRecord::Associations::Builder # :nodoc: diff --git a/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb b/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb index c3e62c1a3d..6b71826431 100644 --- a/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb +++ b/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord::Associations::Builder # :nodoc: class HasAndBelongsToMany # :nodoc: class JoinTableResolver # :nodoc: diff --git a/activerecord/lib/active_record/associations/builder/has_many.rb b/activerecord/lib/active_record/associations/builder/has_many.rb index 3e83fad619..7864d4c536 100644 --- a/activerecord/lib/active_record/associations/builder/has_many.rb +++ b/activerecord/lib/active_record/associations/builder/has_many.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord::Associations::Builder # :nodoc: class HasMany < CollectionAssociation #:nodoc: def self.macro diff --git a/activerecord/lib/active_record/associations/builder/has_one.rb b/activerecord/lib/active_record/associations/builder/has_one.rb index 66135bbc2d..4de846d12b 100644 --- a/activerecord/lib/active_record/associations/builder/has_one.rb +++ b/activerecord/lib/active_record/associations/builder/has_one.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord::Associations::Builder # :nodoc: class HasOne < SingularAssociation #:nodoc: def self.macro diff --git a/activerecord/lib/active_record/associations/builder/singular_association.rb b/activerecord/lib/active_record/associations/builder/singular_association.rb index 3a154ba25f..7732b63af6 100644 --- a/activerecord/lib/active_record/associations/builder/singular_association.rb +++ b/activerecord/lib/active_record/associations/builder/singular_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true # This class is inherited by the has_one and belongs_to association classes module ActiveRecord::Associations::Builder # :nodoc: diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index 8bed7121a8..a49fb155ee 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Associations # = Active Record Association Collection diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb index 6ccdaebbe3..d77fcaf668 100644 --- a/activerecord/lib/active_record/associations/collection_proxy.rb +++ b/activerecord/lib/active_record/associations/collection_proxy.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Associations # Association proxies in Active Record are middlemen between the object that diff --git a/activerecord/lib/active_record/associations/foreign_association.rb b/activerecord/lib/active_record/associations/foreign_association.rb index 1fb6ff7bff..3ceec0ee46 100644 --- a/activerecord/lib/active_record/associations/foreign_association.rb +++ b/activerecord/lib/active_record/associations/foreign_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord::Associations module ForeignAssociation # :nodoc: def foreign_key_present? diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 4e0c89791e..10ca0e47ff 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record Has Many Association module Associations diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb index c4ed91aeca..2fd20b4368 100644 --- a/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record Has Many Through Association module Associations diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb index a78c1b1d32..8458253ff8 100644 --- a/activerecord/lib/active_record/associations/has_one_association.rb +++ b/activerecord/lib/active_record/associations/has_one_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record Has One Association module Associations diff --git a/activerecord/lib/active_record/associations/has_one_through_association.rb b/activerecord/lib/active_record/associations/has_one_through_association.rb index 1e8b2244d9..1183bdf6f4 100644 --- a/activerecord/lib/active_record/associations/has_one_through_association.rb +++ b/activerecord/lib/active_record/associations/has_one_through_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record Has One Through Association module Associations diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index 011bbaad5c..04cdcb6a7f 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Associations class JoinDependency # :nodoc: diff --git a/activerecord/lib/active_record/associations/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/join_dependency/join_association.rb index 5df23e92ca..005410d598 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/associations/join_dependency/join_part" module ActiveRecord diff --git a/activerecord/lib/active_record/associations/join_dependency/join_base.rb b/activerecord/lib/active_record/associations/join_dependency/join_base.rb index aa02c5f056..fca20514d1 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_base.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_base.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/associations/join_dependency/join_part" module ActiveRecord diff --git a/activerecord/lib/active_record/associations/join_dependency/join_part.rb b/activerecord/lib/active_record/associations/join_dependency/join_part.rb index 0604333f30..80c9fde5d1 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_part.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_part.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Associations class JoinDependency # :nodoc: diff --git a/activerecord/lib/active_record/associations/preloader.rb b/activerecord/lib/active_record/associations/preloader.rb index 130494f712..208d1b2670 100644 --- a/activerecord/lib/active_record/associations/preloader.rb +++ b/activerecord/lib/active_record/associations/preloader.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Associations # Implements the details of eager loading of Active Record associations. diff --git a/activerecord/lib/active_record/associations/preloader/association.rb b/activerecord/lib/active_record/associations/preloader/association.rb index 6a8425c989..63ef3f2d8c 100644 --- a/activerecord/lib/active_record/associations/preloader/association.rb +++ b/activerecord/lib/active_record/associations/preloader/association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/preloader/belongs_to.rb b/activerecord/lib/active_record/associations/preloader/belongs_to.rb index ee7be18d15..c20145770f 100644 --- a/activerecord/lib/active_record/associations/preloader/belongs_to.rb +++ b/activerecord/lib/active_record/associations/preloader/belongs_to.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/preloader/collection_association.rb b/activerecord/lib/active_record/associations/preloader/collection_association.rb index 59c0bc4d8e..26690bf16d 100644 --- a/activerecord/lib/active_record/associations/preloader/collection_association.rb +++ b/activerecord/lib/active_record/associations/preloader/collection_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/preloader/has_many.rb b/activerecord/lib/active_record/associations/preloader/has_many.rb index 197f561b95..20df1cc19a 100644 --- a/activerecord/lib/active_record/associations/preloader/has_many.rb +++ b/activerecord/lib/active_record/associations/preloader/has_many.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/preloader/has_many_through.rb b/activerecord/lib/active_record/associations/preloader/has_many_through.rb index 3bd561c187..2029871f39 100644 --- a/activerecord/lib/active_record/associations/preloader/has_many_through.rb +++ b/activerecord/lib/active_record/associations/preloader/has_many_through.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/preloader/has_one.rb b/activerecord/lib/active_record/associations/preloader/has_one.rb index d6254d8c56..c4add621ca 100644 --- a/activerecord/lib/active_record/associations/preloader/has_one.rb +++ b/activerecord/lib/active_record/associations/preloader/has_one.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/preloader/has_one_through.rb b/activerecord/lib/active_record/associations/preloader/has_one_through.rb index 512ca82005..f063f85574 100644 --- a/activerecord/lib/active_record/associations/preloader/has_one_through.rb +++ b/activerecord/lib/active_record/associations/preloader/has_one_through.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/preloader/singular_association.rb b/activerecord/lib/active_record/associations/preloader/singular_association.rb index 5583c7d79c..5c5828262e 100644 --- a/activerecord/lib/active_record/associations/preloader/singular_association.rb +++ b/activerecord/lib/active_record/associations/preloader/singular_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/preloader/through_association.rb b/activerecord/lib/active_record/associations/preloader/through_association.rb index 8e12afc695..34587fd3f5 100644 --- a/activerecord/lib/active_record/associations/preloader/through_association.rb +++ b/activerecord/lib/active_record/associations/preloader/through_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Associations class Preloader diff --git a/activerecord/lib/active_record/associations/singular_association.rb b/activerecord/lib/active_record/associations/singular_association.rb index 891caa44c3..f8bbe4c2ed 100644 --- a/activerecord/lib/active_record/associations/singular_association.rb +++ b/activerecord/lib/active_record/associations/singular_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Associations class SingularAssociation < Association #:nodoc: diff --git a/activerecord/lib/active_record/associations/through_association.rb b/activerecord/lib/active_record/associations/through_association.rb index fd4c1a1e78..6b87993ba3 100644 --- a/activerecord/lib/active_record/associations/through_association.rb +++ b/activerecord/lib/active_record/associations/through_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record Through Association module Associations diff --git a/activerecord/lib/active_record/attribute.rb b/activerecord/lib/active_record/attribute.rb index 7bb0280861..78662433eb 100644 --- a/activerecord/lib/active_record/attribute.rb +++ b/activerecord/lib/active_record/attribute.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class Attribute # :nodoc: class << self diff --git a/activerecord/lib/active_record/attribute/user_provided_default.rb b/activerecord/lib/active_record/attribute/user_provided_default.rb index b2e9ff9d99..57f8bbed76 100644 --- a/activerecord/lib/active_record/attribute/user_provided_default.rb +++ b/activerecord/lib/active_record/attribute/user_provided_default.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/attribute" module ActiveRecord diff --git a/activerecord/lib/active_record/attribute_assignment.rb b/activerecord/lib/active_record/attribute_assignment.rb index 39ba094b6d..d0dfca0cac 100644 --- a/activerecord/lib/active_record/attribute_assignment.rb +++ b/activerecord/lib/active_record/attribute_assignment.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_model/forbidden_attributes_protection" module ActiveRecord diff --git a/activerecord/lib/active_record/attribute_decorators.rb b/activerecord/lib/active_record/attribute_decorators.rb index cb744d7b61..5bc8527745 100644 --- a/activerecord/lib/active_record/attribute_decorators.rb +++ b/activerecord/lib/active_record/attribute_decorators.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module AttributeDecorators # :nodoc: extend ActiveSupport::Concern diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index b718da8555..83c61fad19 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/enumerable" require "active_support/core_ext/string/filters" require "mutex_m" diff --git a/activerecord/lib/active_record/attribute_methods/before_type_cast.rb b/activerecord/lib/active_record/attribute_methods/before_type_cast.rb index 7cdb85e6cf..115eb1ef3f 100644 --- a/activerecord/lib/active_record/attribute_methods/before_type_cast.rb +++ b/activerecord/lib/active_record/attribute_methods/before_type_cast.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module AttributeMethods # = Active Record Attribute Methods Before Type Cast diff --git a/activerecord/lib/active_record/attribute_methods/primary_key.rb b/activerecord/lib/active_record/attribute_methods/primary_key.rb index ca21eae7c1..b9b2acff37 100644 --- a/activerecord/lib/active_record/attribute_methods/primary_key.rb +++ b/activerecord/lib/active_record/attribute_methods/primary_key.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "set" module ActiveRecord diff --git a/activerecord/lib/active_record/attribute_methods/query.rb b/activerecord/lib/active_record/attribute_methods/query.rb index db86ef428e..10498f4322 100644 --- a/activerecord/lib/active_record/attribute_methods/query.rb +++ b/activerecord/lib/active_record/attribute_methods/query.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module AttributeMethods module Query diff --git a/activerecord/lib/active_record/attribute_methods/read.rb b/activerecord/lib/active_record/attribute_methods/read.rb index 9d85af9424..fdc4bf6621 100644 --- a/activerecord/lib/active_record/attribute_methods/read.rb +++ b/activerecord/lib/active_record/attribute_methods/read.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module AttributeMethods module Read diff --git a/activerecord/lib/active_record/attribute_methods/serialization.rb b/activerecord/lib/active_record/attribute_methods/serialization.rb index 0f267e3a34..4d9aff76cc 100644 --- a/activerecord/lib/active_record/attribute_methods/serialization.rb +++ b/activerecord/lib/active_record/attribute_methods/serialization.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module AttributeMethods module Serialization 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 0c5f0a2fd1..1f1efe8812 100644 --- a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb +++ b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module AttributeMethods module TimeZoneConversion diff --git a/activerecord/lib/active_record/attribute_methods/write.rb b/activerecord/lib/active_record/attribute_methods/write.rb index 166cab7dd6..75c5a1a600 100644 --- a/activerecord/lib/active_record/attribute_methods/write.rb +++ b/activerecord/lib/active_record/attribute_methods/write.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module AttributeMethods module Write diff --git a/activerecord/lib/active_record/attribute_mutation_tracker.rb b/activerecord/lib/active_record/attribute_mutation_tracker.rb index 4b0d52742b..4de993e169 100644 --- a/activerecord/lib/active_record/attribute_mutation_tracker.rb +++ b/activerecord/lib/active_record/attribute_mutation_tracker.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class AttributeMutationTracker # :nodoc: OPTION_NOT_GIVEN = Object.new diff --git a/activerecord/lib/active_record/attribute_set.rb b/activerecord/lib/active_record/attribute_set.rb index 76de68ac70..01f9d815d5 100644 --- a/activerecord/lib/active_record/attribute_set.rb +++ b/activerecord/lib/active_record/attribute_set.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/attribute_set/builder" require "active_record/attribute_set/yaml_encoder" diff --git a/activerecord/lib/active_record/attribute_set/builder.rb b/activerecord/lib/active_record/attribute_set/builder.rb index 9b75f185f7..2f624d32af 100644 --- a/activerecord/lib/active_record/attribute_set/builder.rb +++ b/activerecord/lib/active_record/attribute_set/builder.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/attribute" module ActiveRecord diff --git a/activerecord/lib/active_record/attribute_set/yaml_encoder.rb b/activerecord/lib/active_record/attribute_set/yaml_encoder.rb index f3d726f53c..899de14792 100644 --- a/activerecord/lib/active_record/attribute_set/yaml_encoder.rb +++ b/activerecord/lib/active_record/attribute_set/yaml_encoder.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class AttributeSet # Attempts to do more intelligent YAML dumping of an diff --git a/activerecord/lib/active_record/attributes.rb b/activerecord/lib/active_record/attributes.rb index 0dceb417a5..475b9beec4 100644 --- a/activerecord/lib/active_record/attributes.rb +++ b/activerecord/lib/active_record/attributes.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/attribute/user_provided_default" module ActiveRecord diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb index 137e9673ab..70f0e2af8e 100644 --- a/activerecord/lib/active_record/autosave_association.rb +++ b/activerecord/lib/active_record/autosave_association.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record Autosave Association # diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 5229c82f3a..ac1aa2df45 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "yaml" require "active_support/benchmarkable" require "active_support/dependencies" diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb index b25a8e4033..eb44887e18 100644 --- a/activerecord/lib/active_record/callbacks.rb +++ b/activerecord/lib/active_record/callbacks.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record \Callbacks # diff --git a/activerecord/lib/active_record/coders/json.rb b/activerecord/lib/active_record/coders/json.rb index a7ad65fbf4..cb185a881e 100644 --- a/activerecord/lib/active_record/coders/json.rb +++ b/activerecord/lib/active_record/coders/json.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Coders # :nodoc: class JSON # :nodoc: diff --git a/activerecord/lib/active_record/coders/yaml_column.rb b/activerecord/lib/active_record/coders/yaml_column.rb index 7186252b8b..9c52a31b95 100644 --- a/activerecord/lib/active_record/coders/yaml_column.rb +++ b/activerecord/lib/active_record/coders/yaml_column.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "yaml" module ActiveRecord diff --git a/activerecord/lib/active_record/collection_cache_key.rb b/activerecord/lib/active_record/collection_cache_key.rb index 7831aee3a4..8b937b6703 100644 --- a/activerecord/lib/active_record/collection_cache_key.rb +++ b/activerecord/lib/active_record/collection_cache_key.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module CollectionCacheKey def collection_cache_key(collection = all, timestamp_column = :updated_at) # :nodoc: diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index 71a2ac24ea..627b753f01 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "thread" require "concurrent/map" require "monitor" diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb index 6331b1546a..407e019326 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters # :nodoc: module DatabaseLimits diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index c8cf840181..879626b72a 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters # :nodoc: module DatabaseStatements diff --git a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb index 31d8f53a10..c352ddfc11 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters # :nodoc: module QueryCache diff --git a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb index 631e5176bb..61233dcc51 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/big_decimal/conversions" require "active_support/multibyte/chars" diff --git a/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb b/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb index b1b793828d..3a06f75292 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module Savepoints diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb index a3f9edbc6c..8865e7c703 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/string/strip" module ActiveRecord diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index 6dbf669993..a30fbe0e05 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters #:nodoc: # Abstract representation of an index definition on a table. Instances of diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb index ef8038b5c3..34036d8a1d 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters # :nodoc: # The goal of this module is to move Adapter specific column 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 4aed0e214f..6aed00584a 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/migration/join_table" require "active_support/core_ext/string/access" require "digest" diff --git a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb index 013cf5bfb6..19b7821494 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters class TransactionState diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index a7d8a80224..9a085df934 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/type" require "active_record/connection_adapters/determine_if_preparable_visitor" require "active_record/connection_adapters/schema_cache" diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index d49fa7ed24..062fede1ce 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/connection_adapters/abstract_adapter" require "active_record/connection_adapters/statement_pool" require "active_record/connection_adapters/mysql/column" diff --git a/activerecord/lib/active_record/connection_adapters/column.rb b/activerecord/lib/active_record/connection_adapters/column.rb index 34eca70253..61cd7ae4cc 100644 --- a/activerecord/lib/active_record/connection_adapters/column.rb +++ b/activerecord/lib/active_record/connection_adapters/column.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # :stopdoc: module ConnectionAdapters diff --git a/activerecord/lib/active_record/connection_adapters/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/connection_specification.rb index de54787458..3e4ea28f63 100644 --- a/activerecord/lib/active_record/connection_adapters/connection_specification.rb +++ b/activerecord/lib/active_record/connection_adapters/connection_specification.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "uri" module ActiveRecord diff --git a/activerecord/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb b/activerecord/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb index e57147221f..0fdc185c45 100644 --- a/activerecord/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb +++ b/activerecord/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module DetermineIfPreparableVisitor diff --git a/activerecord/lib/active_record/connection_adapters/mysql/column.rb b/activerecord/lib/active_record/connection_adapters/mysql/column.rb index 8bdc2a1622..c9ad47c035 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/column.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/column.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb index dcbb6cfa7a..bda482a00f 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb b/activerecord/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb index f174ba5b0e..9691060cd3 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb b/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb index 9fcf1e0a89..d4f5906b33 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb index a890b54b5e..eea4984680 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb index b62b857bb7..6d88c14d50 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb index 05f12ef05b..eff96e329f 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb index 470e24a8e7..a01fbba201 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql/type_metadata.rb b/activerecord/lib/active_record/connection_adapters/mysql/type_metadata.rb index aa4d98e06b..9ad6a6c0d0 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/type_metadata.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/type_metadata.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module MySQL diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb index 350a99a2e4..af55cfe2f6 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/connection_adapters/abstract_mysql_adapter" require "active_record/connection_adapters/mysql/database_statements" diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb index 36382b6d57..3ad1911a28 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters # PostgreSQL-specific extensions to column definitions in a table. diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb index 659b860cce..ebf1715ed0 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb b/activerecord/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb index 21d0b4a0d2..99f3a5bbdf 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb index ea07b48430..4098250f3e 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/connection_adapters/postgresql/oid/array" require "active_record/connection_adapters/postgresql/oid/bit" require "active_record/connection_adapters/postgresql/oid/bit_varying" diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb index fd629012ec..a73a8c1726 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit.rb index 70e84d85c2..0a505f46a7 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb index b4ea3b4edd..4c21097d48 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb index 4902a64330..702fa8175c 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/cidr.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/cidr.rb index 2007665ec0..5225609e37 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/cidr.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "ipaddr" module ActiveRecord diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb index 110771e7a2..b7acbf7178 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/decimal.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/decimal.rb index bc720a36c8..43d22c8daf 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/decimal.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/decimal.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/enum.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/enum.rb index db1cd22b48..950d23d516 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/enum.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/enum.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb index 828bcd23dd..49dd4fc73f 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/inet.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/inet.rb index 4cc78a8c10..96486fa65b 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/inet.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/inet.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb index bb0f8487fa..3c706c27c4 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb index fcb6c1498d..a1fec289d4 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb index 3ed9fefee8..775eecaf85 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb index cc3e0c9169..7a91272d1c 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/oid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/oid.rb index d8b47e8e29..9c2ac08b30 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/oid.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/oid.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb index 3275f28d0c..7c764e7287 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord Point = Struct.new(:x, :y) diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/range.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/range.rb index eddb0fb0ac..54d5d0902e 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/range.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/range.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb index f5270a64ab..564e82a4ac 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb index 503691f7fc..d9ae1aa7a2 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb index 2fdf3b5d8e..5e839228e9 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/vector.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/vector.rb index 6d86a221a7..b26e876b54 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/vector.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/vector.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/xml.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/xml.rb index f0e21f9f23..d40d837cee 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/xml.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/xml.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb index 628f13c44a..ee4230c6f2 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb b/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb index 3387bad79f..44a7338bf5 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_creation.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_creation.rb index 5fab6f60d2..e1d5089115 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_creation.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_creation.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb index 32b7239f54..11ea1e5144 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb index a631e4534f..5555a46b6b 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL 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 14e4929919..a710ea6cc9 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/string/strip" module ActiveRecord diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb b/activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb index 110cc88872..f57179ae59 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters class PostgreSQLTypeMetadata < DelegateClass(SqlTypeMetadata) diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/utils.rb b/activerecord/lib/active_record/connection_adapters/postgresql/utils.rb index 6a4d6d50bd..aa7940188a 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/utils.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/utils.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 38285366b4..e63563afc4 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true # Make sure we're using pg high enough for type casts and Ruby 2.2+ compatibility gem "pg", "~> 0.18" require "pg" diff --git a/activerecord/lib/active_record/connection_adapters/schema_cache.rb b/activerecord/lib/active_record/connection_adapters/schema_cache.rb index 32aa9d803b..4d339b0a8c 100644 --- a/activerecord/lib/active_record/connection_adapters/schema_cache.rb +++ b/activerecord/lib/active_record/connection_adapters/schema_cache.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters class SchemaCache diff --git a/activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb b/activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb index e6908e9846..9e12ae0de8 100644 --- a/activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb +++ b/activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # :stopdoc: module ConnectionAdapters diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb index 01cfafdd2b..6fe3e1211e 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module SQLite3 diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb index c5bc797d48..7276a65098 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module SQLite3 diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_creation.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_creation.rb index bcd43eac08..bc798d1dbb 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_creation.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_creation.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module SQLite3 diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb index 7bbda675eb..e157e4b218 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module SQLite3 diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb index d265a60206..eec018eda3 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module SQLite3 diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb index c268fc173b..31e83f9260 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module SQLite3 diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index 31d5b5946e..17c63d4b5f 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/connection_adapters/abstract_adapter" require "active_record/connection_adapters/statement_pool" require "active_record/connection_adapters/sqlite3/explain_pretty_printer" diff --git a/activerecord/lib/active_record/connection_adapters/statement_pool.rb b/activerecord/lib/active_record/connection_adapters/statement_pool.rb index e7c237d42f..790db56185 100644 --- a/activerecord/lib/active_record/connection_adapters/statement_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/statement_pool.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionAdapters class StatementPool # :nodoc: diff --git a/activerecord/lib/active_record/connection_handling.rb b/activerecord/lib/active_record/connection_handling.rb index 61f160b99d..b8fbb489b6 100644 --- a/activerecord/lib/active_record/connection_handling.rb +++ b/activerecord/lib/active_record/connection_handling.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionHandling RAILS_ENV = -> { (Rails.env if defined?(Rails.env)) || ENV["RAILS_ENV"].presence || ENV["RACK_ENV"].presence } diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index f1eaa07f1a..198c712abc 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "thread" require "active_support/core_ext/hash/indifferent_access" require "active_support/core_ext/object/duplicable" diff --git a/activerecord/lib/active_record/counter_cache.rb b/activerecord/lib/active_record/counter_cache.rb index 5dcd28244a..cbd71a3779 100644 --- a/activerecord/lib/active_record/counter_cache.rb +++ b/activerecord/lib/active_record/counter_cache.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record Counter Cache module CounterCache diff --git a/activerecord/lib/active_record/define_callbacks.rb b/activerecord/lib/active_record/define_callbacks.rb index 291ebd3678..7d955a24be 100644 --- a/activerecord/lib/active_record/define_callbacks.rb +++ b/activerecord/lib/active_record/define_callbacks.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # This module exists because `ActiveRecord::AttributeMethods::Dirty` needs to # define callbacks, but continue to have its version of `save` be the super diff --git a/activerecord/lib/active_record/dynamic_matchers.rb b/activerecord/lib/active_record/dynamic_matchers.rb index a3425c8097..3a9625092e 100644 --- a/activerecord/lib/active_record/dynamic_matchers.rb +++ b/activerecord/lib/active_record/dynamic_matchers.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module DynamicMatchers #:nodoc: private diff --git a/activerecord/lib/active_record/enum.rb b/activerecord/lib/active_record/enum.rb index 86ffa28306..12ef58a941 100644 --- a/activerecord/lib/active_record/enum.rb +++ b/activerecord/lib/active_record/enum.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/object/deep_dup" module ActiveRecord diff --git a/activerecord/lib/active_record/errors.rb b/activerecord/lib/active_record/errors.rb index 7507d61535..60d4fb70e0 100644 --- a/activerecord/lib/active_record/errors.rb +++ b/activerecord/lib/active_record/errors.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record Errors # diff --git a/activerecord/lib/active_record/explain.rb b/activerecord/lib/active_record/explain.rb index 31449e810e..5e67d16e9f 100644 --- a/activerecord/lib/active_record/explain.rb +++ b/activerecord/lib/active_record/explain.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/explain_registry" module ActiveRecord diff --git a/activerecord/lib/active_record/explain_registry.rb b/activerecord/lib/active_record/explain_registry.rb index 0af48be6fd..ef1ce3dc85 100644 --- a/activerecord/lib/active_record/explain_registry.rb +++ b/activerecord/lib/active_record/explain_registry.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/per_thread_registry" module ActiveRecord diff --git a/activerecord/lib/active_record/explain_subscriber.rb b/activerecord/lib/active_record/explain_subscriber.rb index 07a412a8a1..abd8cfc8f2 100644 --- a/activerecord/lib/active_record/explain_subscriber.rb +++ b/activerecord/lib/active_record/explain_subscriber.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/notifications" require "active_record/explain_registry" diff --git a/activerecord/lib/active_record/fixture_set/file.rb b/activerecord/lib/active_record/fixture_set/file.rb index 93b8ba07e9..6cf2e01179 100644 --- a/activerecord/lib/active_record/fixture_set/file.rb +++ b/activerecord/lib/active_record/fixture_set/file.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "erb" require "yaml" diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 1835965b7f..e9acb8acae 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "erb" require "yaml" require "zlib" diff --git a/activerecord/lib/active_record/gem_version.rb b/activerecord/lib/active_record/gem_version.rb index a0434766f5..1a937dbcf7 100644 --- a/activerecord/lib/active_record/gem_version.rb +++ b/activerecord/lib/active_record/gem_version.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # Returns the version of the currently loaded Active Record as a Gem::Version def self.gem_version diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb index 10911b9a3e..5776807507 100644 --- a/activerecord/lib/active_record/inheritance.rb +++ b/activerecord/lib/active_record/inheritance.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/hash/indifferent_access" module ActiveRecord diff --git a/activerecord/lib/active_record/integration.rb b/activerecord/lib/active_record/integration.rb index 2bb96457c6..cf954852bc 100644 --- a/activerecord/lib/active_record/integration.rb +++ b/activerecord/lib/active_record/integration.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/string/filters" module ActiveRecord diff --git a/activerecord/lib/active_record/internal_metadata.rb b/activerecord/lib/active_record/internal_metadata.rb index 9ec6b51cb3..25ee9d6bfe 100644 --- a/activerecord/lib/active_record/internal_metadata.rb +++ b/activerecord/lib/active_record/internal_metadata.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/scoping/default" require "active_record/scoping/named" diff --git a/activerecord/lib/active_record/legacy_yaml_adapter.rb b/activerecord/lib/active_record/legacy_yaml_adapter.rb index ba74f1a56c..c7683f68c7 100644 --- a/activerecord/lib/active_record/legacy_yaml_adapter.rb +++ b/activerecord/lib/active_record/legacy_yaml_adapter.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module LegacyYamlAdapter def self.convert(klass, coder) diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 2e2f2979d8..522da6a571 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Locking # == What is Optimistic Locking diff --git a/activerecord/lib/active_record/locking/pessimistic.rb b/activerecord/lib/active_record/locking/pessimistic.rb index 0fb4dc3a35..263e2a5f7f 100644 --- a/activerecord/lib/active_record/locking/pessimistic.rb +++ b/activerecord/lib/active_record/locking/pessimistic.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Locking # Locking::Pessimistic provides support for row-level locking using diff --git a/activerecord/lib/active_record/log_subscriber.rb b/activerecord/lib/active_record/log_subscriber.rb index e8593c1a48..e39ca5f6dc 100644 --- a/activerecord/lib/active_record/log_subscriber.rb +++ b/activerecord/lib/active_record/log_subscriber.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class LogSubscriber < ActiveSupport::LogSubscriber IGNORE_PAYLOAD_NAMES = ["SCHEMA", "EXPLAIN"] diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 1b1403b1a5..1ff1dcad43 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "set" require "zlib" require "active_support/core_ext/module/attribute_accessors" diff --git a/activerecord/lib/active_record/migration/command_recorder.rb b/activerecord/lib/active_record/migration/command_recorder.rb index 1641044841..f9cf59b283 100644 --- a/activerecord/lib/active_record/migration/command_recorder.rb +++ b/activerecord/lib/active_record/migration/command_recorder.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class Migration # ActiveRecord::Migration::CommandRecorder records commands done during diff --git a/activerecord/lib/active_record/migration/compatibility.rb b/activerecord/lib/active_record/migration/compatibility.rb index ccb1b2ddd7..188dd0acef 100644 --- a/activerecord/lib/active_record/migration/compatibility.rb +++ b/activerecord/lib/active_record/migration/compatibility.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class Migration module Compatibility # :nodoc: all diff --git a/activerecord/lib/active_record/migration/join_table.rb b/activerecord/lib/active_record/migration/join_table.rb index 026217880c..89789f00ea 100644 --- a/activerecord/lib/active_record/migration/join_table.rb +++ b/activerecord/lib/active_record/migration/join_table.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class Migration module JoinTable #:nodoc: diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb index e846bcc1a1..14e0f5bff7 100644 --- a/activerecord/lib/active_record/model_schema.rb +++ b/activerecord/lib/active_record/model_schema.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "monitor" module ActiveRecord diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index 43d4364e35..917bc76993 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/hash/except" require "active_support/core_ext/object/try" require "active_support/core_ext/hash/indifferent_access" diff --git a/activerecord/lib/active_record/no_touching.rb b/activerecord/lib/active_record/no_touching.rb index 84ee036c17..4059020e25 100644 --- a/activerecord/lib/active_record/no_touching.rb +++ b/activerecord/lib/active_record/no_touching.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record No Touching module NoTouching diff --git a/activerecord/lib/active_record/null_relation.rb b/activerecord/lib/active_record/null_relation.rb index 6d65154a14..26966f9433 100644 --- a/activerecord/lib/active_record/null_relation.rb +++ b/activerecord/lib/active_record/null_relation.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module NullRelation # :nodoc: def pluck(*column_names) diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index c310ae3575..b2dba5516e 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record \Persistence module Persistence diff --git a/activerecord/lib/active_record/query_cache.rb b/activerecord/lib/active_record/query_cache.rb index 17e6bbfec0..e4c2e1f86f 100644 --- a/activerecord/lib/active_record/query_cache.rb +++ b/activerecord/lib/active_record/query_cache.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record Query Cache class QueryCache diff --git a/activerecord/lib/active_record/querying.rb b/activerecord/lib/active_record/querying.rb index dd7d833a96..b16e178358 100644 --- a/activerecord/lib/active_record/querying.rb +++ b/activerecord/lib/active_record/querying.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Querying delegate :find, :take, :take!, :first, :first!, :last, :last!, :exists?, :any?, :many?, :none?, :one?, to: :all diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 441dca9fe7..73518ca144 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record" require "rails" require "active_model/railtie" diff --git a/activerecord/lib/active_record/railties/console_sandbox.rb b/activerecord/lib/active_record/railties/console_sandbox.rb index 03286eacbb..604a220303 100644 --- a/activerecord/lib/active_record/railties/console_sandbox.rb +++ b/activerecord/lib/active_record/railties/console_sandbox.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true ActiveRecord::Base.connection.begin_transaction(joinable: false) at_exit do diff --git a/activerecord/lib/active_record/railties/controller_runtime.rb b/activerecord/lib/active_record/railties/controller_runtime.rb index 297f3fc8bc..8658188623 100644 --- a/activerecord/lib/active_record/railties/controller_runtime.rb +++ b/activerecord/lib/active_record/railties/controller_runtime.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/module/attr_internal" require "active_record/log_subscriber" diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index 7c0d066e88..711099e9e1 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record" db_namespace = namespace :db do diff --git a/activerecord/lib/active_record/railties/jdbcmysql_error.rb b/activerecord/lib/active_record/railties/jdbcmysql_error.rb index f614c067d7..d7cf4df339 100644 --- a/activerecord/lib/active_record/railties/jdbcmysql_error.rb +++ b/activerecord/lib/active_record/railties/jdbcmysql_error.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true #FIXME Remove if ArJdbcMysql will give. module ArJdbcMySQL #:nodoc: class Error < StandardError #:nodoc: diff --git a/activerecord/lib/active_record/readonly_attributes.rb b/activerecord/lib/active_record/readonly_attributes.rb index 7bf305eb31..af6473d250 100644 --- a/activerecord/lib/active_record/readonly_attributes.rb +++ b/activerecord/lib/active_record/readonly_attributes.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ReadonlyAttributes extend ActiveSupport::Concern diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 6318bff685..8ff2f50fdb 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "thread" require "active_support/core_ext/string/filters" require "active_support/deprecation" diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 55b59eeb54..52f5d5f3e3 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record \Relation class Relation diff --git a/activerecord/lib/active_record/relation/batches.rb b/activerecord/lib/active_record/relation/batches.rb index ac48ffb1bc..13a2c3f511 100644 --- a/activerecord/lib/active_record/relation/batches.rb +++ b/activerecord/lib/active_record/relation/batches.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/relation/batches/batch_enumerator" module ActiveRecord diff --git a/activerecord/lib/active_record/relation/batches/batch_enumerator.rb b/activerecord/lib/active_record/relation/batches/batch_enumerator.rb index 02c70d5cf0..3555779ec2 100644 --- a/activerecord/lib/active_record/relation/batches/batch_enumerator.rb +++ b/activerecord/lib/active_record/relation/batches/batch_enumerator.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Batches class BatchEnumerator diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 6514c7bde8..8a54f8f2c3 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Calculations # Count the records. diff --git a/activerecord/lib/active_record/relation/delegation.rb b/activerecord/lib/active_record/relation/delegation.rb index 6d3b59d339..48c4dcdef4 100644 --- a/activerecord/lib/active_record/relation/delegation.rb +++ b/activerecord/lib/active_record/relation/delegation.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Delegation # :nodoc: module DelegateCache # :nodoc: diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 88c68685bc..eee0f36f63 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/string/filters" module ActiveRecord diff --git a/activerecord/lib/active_record/relation/from_clause.rb b/activerecord/lib/active_record/relation/from_clause.rb index ea838b79a6..8945cb0cc5 100644 --- a/activerecord/lib/active_record/relation/from_clause.rb +++ b/activerecord/lib/active_record/relation/from_clause.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class Relation class FromClause # :nodoc: diff --git a/activerecord/lib/active_record/relation/merger.rb b/activerecord/lib/active_record/relation/merger.rb index 84c31e4126..5dac00724a 100644 --- a/activerecord/lib/active_record/relation/merger.rb +++ b/activerecord/lib/active_record/relation/merger.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/hash/keys" module ActiveRecord diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index 72314180dd..7dea5deec5 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class PredicateBuilder # :nodoc: delegate :resolve_column_aliases, to: :table diff --git a/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb b/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb index 4d0778df36..1068e700e2 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class PredicateBuilder class ArrayHandler # :nodoc: diff --git a/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb b/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb index 66690d6b5c..3e19646ae5 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class PredicateBuilder class AssociationQueryValue # :nodoc: diff --git a/activerecord/lib/active_record/relation/predicate_builder/base_handler.rb b/activerecord/lib/active_record/relation/predicate_builder/base_handler.rb index 3472b16cef..3bb1037885 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/base_handler.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/base_handler.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class PredicateBuilder class BaseHandler # :nodoc: diff --git a/activerecord/lib/active_record/relation/predicate_builder/basic_object_handler.rb b/activerecord/lib/active_record/relation/predicate_builder/basic_object_handler.rb index 3190602506..79cde00303 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/basic_object_handler.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/basic_object_handler.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class PredicateBuilder class BasicObjectHandler # :nodoc: diff --git a/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb b/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb index 5032177757..7029ae5f47 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class PredicateBuilder class PolymorphicArrayValue # :nodoc: diff --git a/activerecord/lib/active_record/relation/predicate_builder/range_handler.rb b/activerecord/lib/active_record/relation/predicate_builder/range_handler.rb index ddd804b508..5db778e19c 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/range_handler.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/range_handler.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class PredicateBuilder class RangeHandler # :nodoc: diff --git a/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb b/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb index 4e1e644599..8a910a82fe 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class PredicateBuilder class RelationHandler # :nodoc: diff --git a/activerecord/lib/active_record/relation/query_attribute.rb b/activerecord/lib/active_record/relation/query_attribute.rb index 410a375e52..a68e508fcc 100644 --- a/activerecord/lib/active_record/relation/query_attribute.rb +++ b/activerecord/lib/active_record/relation/query_attribute.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/attribute" module ActiveRecord diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 4ddc933e3d..d44f6fd572 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/relation/from_clause" require "active_record/relation/query_attribute" require "active_record/relation/where_clause" diff --git a/activerecord/lib/active_record/relation/record_fetch_warning.rb b/activerecord/lib/active_record/relation/record_fetch_warning.rb index 8e221f1570..31544c730e 100644 --- a/activerecord/lib/active_record/relation/record_fetch_warning.rb +++ b/activerecord/lib/active_record/relation/record_fetch_warning.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class Relation module RecordFetchWarning diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb index 8b7b01259e..ada89b5ec3 100644 --- a/activerecord/lib/active_record/relation/spawn_methods.rb +++ b/activerecord/lib/active_record/relation/spawn_methods.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/hash/except" require "active_support/core_ext/hash/slice" require "active_record/relation/merger" diff --git a/activerecord/lib/active_record/relation/where_clause.rb b/activerecord/lib/active_record/relation/where_clause.rb index a809752928..119910ee79 100644 --- a/activerecord/lib/active_record/relation/where_clause.rb +++ b/activerecord/lib/active_record/relation/where_clause.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class Relation class WhereClause # :nodoc: diff --git a/activerecord/lib/active_record/relation/where_clause_factory.rb b/activerecord/lib/active_record/relation/where_clause_factory.rb index 156088f534..b862dd56a5 100644 --- a/activerecord/lib/active_record/relation/where_clause_factory.rb +++ b/activerecord/lib/active_record/relation/where_clause_factory.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class Relation class WhereClauseFactory # :nodoc: diff --git a/activerecord/lib/active_record/result.rb b/activerecord/lib/active_record/result.rb index 5e1c0bfefc..26b1d48e9e 100644 --- a/activerecord/lib/active_record/result.rb +++ b/activerecord/lib/active_record/result.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord ### # This class encapsulates a result returned from calling diff --git a/activerecord/lib/active_record/runtime_registry.rb b/activerecord/lib/active_record/runtime_registry.rb index d068d8898e..b79eb2263f 100644 --- a/activerecord/lib/active_record/runtime_registry.rb +++ b/activerecord/lib/active_record/runtime_registry.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/per_thread_registry" module ActiveRecord diff --git a/activerecord/lib/active_record/sanitization.rb b/activerecord/lib/active_record/sanitization.rb index a39e1a2e73..64bda1539c 100644 --- a/activerecord/lib/active_record/sanitization.rb +++ b/activerecord/lib/active_record/sanitization.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Sanitization extend ActiveSupport::Concern diff --git a/activerecord/lib/active_record/schema.rb b/activerecord/lib/active_record/schema.rb index 2578c5e3ef..5104427339 100644 --- a/activerecord/lib/active_record/schema.rb +++ b/activerecord/lib/active_record/schema.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record \Schema # diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index 767da6816d..66a2846f3a 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "stringio" module ActiveRecord diff --git a/activerecord/lib/active_record/schema_migration.rb b/activerecord/lib/active_record/schema_migration.rb index e6336dfde3..f59737afb0 100644 --- a/activerecord/lib/active_record/schema_migration.rb +++ b/activerecord/lib/active_record/schema_migration.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/scoping/default" require "active_record/scoping/named" diff --git a/activerecord/lib/active_record/scoping.rb b/activerecord/lib/active_record/scoping.rb index c2cd35ee3b..94e0ef6724 100644 --- a/activerecord/lib/active_record/scoping.rb +++ b/activerecord/lib/active_record/scoping.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/per_thread_registry" module ActiveRecord diff --git a/activerecord/lib/active_record/scoping/default.rb b/activerecord/lib/active_record/scoping/default.rb index eeb89c405a..70b2693b28 100644 --- a/activerecord/lib/active_record/scoping/default.rb +++ b/activerecord/lib/active_record/scoping/default.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Scoping module Default diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb index c16cbce109..b4026fabb2 100644 --- a/activerecord/lib/active_record/scoping/named.rb +++ b/activerecord/lib/active_record/scoping/named.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/array" require "active_support/core_ext/hash/except" require "active_support/core_ext/kernel/singleton_class" diff --git a/activerecord/lib/active_record/secure_token.rb b/activerecord/lib/active_record/secure_token.rb index 3b2d7e10bd..115799cc20 100644 --- a/activerecord/lib/active_record/secure_token.rb +++ b/activerecord/lib/active_record/secure_token.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module SecureToken extend ActiveSupport::Concern diff --git a/activerecord/lib/active_record/serialization.rb b/activerecord/lib/active_record/serialization.rb index 1907defb2e..db2bd0b55e 100644 --- a/activerecord/lib/active_record/serialization.rb +++ b/activerecord/lib/active_record/serialization.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord #:nodoc: # = Active Record \Serialization module Serialization diff --git a/activerecord/lib/active_record/statement_cache.rb b/activerecord/lib/active_record/statement_cache.rb index fd04f9aedb..1877489e55 100644 --- a/activerecord/lib/active_record/statement_cache.rb +++ b/activerecord/lib/active_record/statement_cache.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # Statement cache is used to cache a single statement in order to avoid creating the AST again. # Initializing the cache is done by passing the statement in the create block: diff --git a/activerecord/lib/active_record/store.rb b/activerecord/lib/active_record/store.rb index 37888c28b5..006afe7495 100644 --- a/activerecord/lib/active_record/store.rb +++ b/activerecord/lib/active_record/store.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/hash/indifferent_access" module ActiveRecord diff --git a/activerecord/lib/active_record/suppressor.rb b/activerecord/lib/active_record/suppressor.rb index 02185c2e0b..d9acb1a1dc 100644 --- a/activerecord/lib/active_record/suppressor.rb +++ b/activerecord/lib/active_record/suppressor.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # ActiveRecord::Suppressor prevents the receiver from being saved during # a given block. diff --git a/activerecord/lib/active_record/table_metadata.rb b/activerecord/lib/active_record/table_metadata.rb index a5dd3008d0..71efc1829a 100644 --- a/activerecord/lib/active_record/table_metadata.rb +++ b/activerecord/lib/active_record/table_metadata.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord class TableMetadata # :nodoc: delegate :foreign_type, :foreign_key, to: :association, prefix: true diff --git a/activerecord/lib/active_record/tasks/database_tasks.rb b/activerecord/lib/active_record/tasks/database_tasks.rb index bdfa683be4..ba686fc562 100644 --- a/activerecord/lib/active_record/tasks/database_tasks.rb +++ b/activerecord/lib/active_record/tasks/database_tasks.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Tasks # :nodoc: class DatabaseAlreadyExists < StandardError; end # :nodoc: diff --git a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb index 730d077ecf..88cbd6f6f5 100644 --- a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Tasks # :nodoc: class MySQLDatabaseTasks # :nodoc: diff --git a/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb b/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb index e49480b27b..7f1a768d8b 100644 --- a/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "tempfile" module ActiveRecord diff --git a/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb b/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb index 559142b57a..01562b21e9 100644 --- a/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Tasks # :nodoc: class SQLiteDatabaseTasks # :nodoc: diff --git a/activerecord/lib/active_record/touch_later.rb b/activerecord/lib/active_record/touch_later.rb index 1e484e59e3..cacde9c881 100644 --- a/activerecord/lib/active_record/touch_later.rb +++ b/activerecord/lib/active_record/touch_later.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record Touch Later module TouchLater diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb index 4e8d2a44e1..45795fa287 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # See ActiveRecord::Transactions::ClassMethods for documentation. module Transactions diff --git a/activerecord/lib/active_record/translation.rb b/activerecord/lib/active_record/translation.rb index ecc508902c..ddcb5f2a7a 100644 --- a/activerecord/lib/active_record/translation.rb +++ b/activerecord/lib/active_record/translation.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Translation include ActiveModel::Translation diff --git a/activerecord/lib/active_record/type.rb b/activerecord/lib/active_record/type.rb index a179582e13..9ed6c95bf9 100644 --- a/activerecord/lib/active_record/type.rb +++ b/activerecord/lib/active_record/type.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_model/type" require "active_record/type/internal/timezone" diff --git a/activerecord/lib/active_record/type/adapter_specific_registry.rb b/activerecord/lib/active_record/type/adapter_specific_registry.rb index f24b9b9a36..7cc866f7a7 100644 --- a/activerecord/lib/active_record/type/adapter_specific_registry.rb +++ b/activerecord/lib/active_record/type/adapter_specific_registry.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_model/type/registry" module ActiveRecord diff --git a/activerecord/lib/active_record/type/date.rb b/activerecord/lib/active_record/type/date.rb index f1a40a8a6b..ccafed054e 100644 --- a/activerecord/lib/active_record/type/date.rb +++ b/activerecord/lib/active_record/type/date.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Type class Date < ActiveModel::Type::Date diff --git a/activerecord/lib/active_record/type/date_time.rb b/activerecord/lib/active_record/type/date_time.rb index dadd76dbe0..1fb9380ecd 100644 --- a/activerecord/lib/active_record/type/date_time.rb +++ b/activerecord/lib/active_record/type/date_time.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Type class DateTime < ActiveModel::Type::DateTime diff --git a/activerecord/lib/active_record/type/decimal_without_scale.rb b/activerecord/lib/active_record/type/decimal_without_scale.rb index ed0a4cfb23..53a5e205da 100644 --- a/activerecord/lib/active_record/type/decimal_without_scale.rb +++ b/activerecord/lib/active_record/type/decimal_without_scale.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Type class DecimalWithoutScale < ActiveModel::Type::BigInteger # :nodoc: diff --git a/activerecord/lib/active_record/type/hash_lookup_type_map.rb b/activerecord/lib/active_record/type/hash_lookup_type_map.rb index 96b6297132..0145d5d6c1 100644 --- a/activerecord/lib/active_record/type/hash_lookup_type_map.rb +++ b/activerecord/lib/active_record/type/hash_lookup_type_map.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Type class HashLookupTypeMap < TypeMap # :nodoc: diff --git a/activerecord/lib/active_record/type/internal/timezone.rb b/activerecord/lib/active_record/type/internal/timezone.rb index 0c7d8ed76e..947e06158a 100644 --- a/activerecord/lib/active_record/type/internal/timezone.rb +++ b/activerecord/lib/active_record/type/internal/timezone.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Type module Internal diff --git a/activerecord/lib/active_record/type/json.rb b/activerecord/lib/active_record/type/json.rb index 9aec74241b..c4732fe388 100644 --- a/activerecord/lib/active_record/type/json.rb +++ b/activerecord/lib/active_record/type/json.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Type class Json < ActiveModel::Type::Value diff --git a/activerecord/lib/active_record/type/serialized.rb b/activerecord/lib/active_record/type/serialized.rb index 96e7ad7152..edbd20a6c1 100644 --- a/activerecord/lib/active_record/type/serialized.rb +++ b/activerecord/lib/active_record/type/serialized.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Type class Serialized < DelegateClass(ActiveModel::Type::Value) # :nodoc: diff --git a/activerecord/lib/active_record/type/text.rb b/activerecord/lib/active_record/type/text.rb index 3d7dd630e3..cb1949700a 100644 --- a/activerecord/lib/active_record/type/text.rb +++ b/activerecord/lib/active_record/type/text.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Type class Text < ActiveModel::Type::String # :nodoc: diff --git a/activerecord/lib/active_record/type/time.rb b/activerecord/lib/active_record/type/time.rb index 3ca7010c79..b9bac87c67 100644 --- a/activerecord/lib/active_record/type/time.rb +++ b/activerecord/lib/active_record/type/time.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Type class Time < ActiveModel::Type::Time diff --git a/activerecord/lib/active_record/type/type_map.rb b/activerecord/lib/active_record/type/type_map.rb index f28caff991..7bce82a1ff 100644 --- a/activerecord/lib/active_record/type/type_map.rb +++ b/activerecord/lib/active_record/type/type_map.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "concurrent/map" module ActiveRecord diff --git a/activerecord/lib/active_record/type/unsigned_integer.rb b/activerecord/lib/active_record/type/unsigned_integer.rb index 45f5dc506e..9ae0109f9f 100644 --- a/activerecord/lib/active_record/type/unsigned_integer.rb +++ b/activerecord/lib/active_record/type/unsigned_integer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Type class UnsignedInteger < ActiveModel::Type::Integer # :nodoc: diff --git a/activerecord/lib/active_record/type_caster.rb b/activerecord/lib/active_record/type_caster.rb index dbe91dc12b..f1686e4913 100644 --- a/activerecord/lib/active_record/type_caster.rb +++ b/activerecord/lib/active_record/type_caster.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record/type_caster/map" require "active_record/type_caster/connection" diff --git a/activerecord/lib/active_record/type_caster/connection.rb b/activerecord/lib/active_record/type_caster/connection.rb index 4f4570db58..9f7bbe8843 100644 --- a/activerecord/lib/active_record/type_caster/connection.rb +++ b/activerecord/lib/active_record/type_caster/connection.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module TypeCaster class Connection # :nodoc: diff --git a/activerecord/lib/active_record/type_caster/map.rb b/activerecord/lib/active_record/type_caster/map.rb index fd3477a826..9f79723125 100644 --- a/activerecord/lib/active_record/type_caster/map.rb +++ b/activerecord/lib/active_record/type_caster/map.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module TypeCaster class Map # :nodoc: diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index 4727221774..9633f226f0 100644 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord # = Active Record \RecordInvalid # diff --git a/activerecord/lib/active_record/validations/absence.rb b/activerecord/lib/active_record/validations/absence.rb index 57fbdb92ee..641d041f3d 100644 --- a/activerecord/lib/active_record/validations/absence.rb +++ b/activerecord/lib/active_record/validations/absence.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Validations class AbsenceValidator < ActiveModel::Validations::AbsenceValidator # :nodoc: diff --git a/activerecord/lib/active_record/validations/associated.rb b/activerecord/lib/active_record/validations/associated.rb index d7752b428b..c695965d7b 100644 --- a/activerecord/lib/active_record/validations/associated.rb +++ b/activerecord/lib/active_record/validations/associated.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Validations class AssociatedValidator < ActiveModel::EachValidator #:nodoc: diff --git a/activerecord/lib/active_record/validations/length.rb b/activerecord/lib/active_record/validations/length.rb index 82a17b4807..0e0cebce4a 100644 --- a/activerecord/lib/active_record/validations/length.rb +++ b/activerecord/lib/active_record/validations/length.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Validations class LengthValidator < ActiveModel::Validations::LengthValidator # :nodoc: diff --git a/activerecord/lib/active_record/validations/presence.rb b/activerecord/lib/active_record/validations/presence.rb index a8f8bc6b02..7cfd55f516 100644 --- a/activerecord/lib/active_record/validations/presence.rb +++ b/activerecord/lib/active_record/validations/presence.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Validations class PresenceValidator < ActiveModel::Validations::PresenceValidator # :nodoc: diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb index 86eeb5d7c5..154cf5f1a4 100644 --- a/activerecord/lib/active_record/validations/uniqueness.rb +++ b/activerecord/lib/active_record/validations/uniqueness.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module Validations class UniquenessValidator < ActiveModel::EachValidator # :nodoc: diff --git a/activerecord/lib/active_record/version.rb b/activerecord/lib/active_record/version.rb index 78e9169b2e..146cfacc18 100644 --- a/activerecord/lib/active_record/version.rb +++ b/activerecord/lib/active_record/version.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require_relative "gem_version" module ActiveRecord diff --git a/activerecord/lib/rails/generators/active_record.rb b/activerecord/lib/rails/generators/active_record.rb index aaa2a14702..a79b8eafea 100644 --- a/activerecord/lib/rails/generators/active_record.rb +++ b/activerecord/lib/rails/generators/active_record.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "rails/generators/named_base" require "rails/generators/active_model" require "rails/generators/active_record/migration" diff --git a/activerecord/lib/rails/generators/active_record/migration.rb b/activerecord/lib/rails/generators/active_record/migration.rb index 6d07438dcb..47c0981a49 100644 --- a/activerecord/lib/rails/generators/active_record/migration.rb +++ b/activerecord/lib/rails/generators/active_record/migration.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "rails/generators/migration" module ActiveRecord diff --git a/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb b/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb index 61f507ddb3..1f1c47499b 100644 --- a/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb +++ b/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "rails/generators/active_record" module ActiveRecord diff --git a/activerecord/lib/rails/generators/active_record/model/model_generator.rb b/activerecord/lib/rails/generators/active_record/model/model_generator.rb index ee321089af..5cec07d2e3 100644 --- a/activerecord/lib/rails/generators/active_record/model/model_generator.rb +++ b/activerecord/lib/rails/generators/active_record/model/model_generator.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "rails/generators/active_record" module ActiveRecord diff --git a/activerecord/test/active_record/connection_adapters/fake_adapter.rb b/activerecord/test/active_record/connection_adapters/fake_adapter.rb index 9391569f2f..b0d8050721 100644 --- a/activerecord/test/active_record/connection_adapters/fake_adapter.rb +++ b/activerecord/test/active_record/connection_adapters/fake_adapter.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ConnectionHandling def fake_connection(config) diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb index dd891cb2ed..a1fb6427f9 100644 --- a/activerecord/test/cases/adapter_test.rb +++ b/activerecord/test/cases/adapter_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/book" require "models/post" diff --git a/activerecord/test/cases/adapters/mysql2/active_schema_test.rb b/activerecord/test/cases/adapters/mysql2/active_schema_test.rb index fdf83aaf88..67e1efde27 100644 --- a/activerecord/test/cases/adapters/mysql2/active_schema_test.rb +++ b/activerecord/test/cases/adapters/mysql2/active_schema_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/mysql2/bind_parameter_test.rb b/activerecord/test/cases/adapters/mysql2/bind_parameter_test.rb index 9f3d1459f7..8f7c803a21 100644 --- a/activerecord/test/cases/adapters/mysql2/bind_parameter_test.rb +++ b/activerecord/test/cases/adapters/mysql2/bind_parameter_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" diff --git a/activerecord/test/cases/adapters/mysql2/boolean_test.rb b/activerecord/test/cases/adapters/mysql2/boolean_test.rb index 9267d15def..58698d59db 100644 --- a/activerecord/test/cases/adapters/mysql2/boolean_test.rb +++ b/activerecord/test/cases/adapters/mysql2/boolean_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class Mysql2BooleanTest < ActiveRecord::Mysql2TestCase diff --git a/activerecord/test/cases/adapters/mysql2/case_sensitivity_test.rb b/activerecord/test/cases/adapters/mysql2/case_sensitivity_test.rb index 65dc369213..50ba9ab831 100644 --- a/activerecord/test/cases/adapters/mysql2/case_sensitivity_test.rb +++ b/activerecord/test/cases/adapters/mysql2/case_sensitivity_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class Mysql2CaseSensitivityTest < ActiveRecord::Mysql2TestCase diff --git a/activerecord/test/cases/adapters/mysql2/charset_collation_test.rb b/activerecord/test/cases/adapters/mysql2/charset_collation_test.rb index e77f4a90d4..e4a6ed5482 100644 --- a/activerecord/test/cases/adapters/mysql2/charset_collation_test.rb +++ b/activerecord/test/cases/adapters/mysql2/charset_collation_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/mysql2/connection_test.rb b/activerecord/test/cases/adapters/mysql2/connection_test.rb index c5ff145e74..a2faf43b0d 100644 --- a/activerecord/test/cases/adapters/mysql2/connection_test.rb +++ b/activerecord/test/cases/adapters/mysql2/connection_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/mysql2/datetime_precision_quoting_test.rb b/activerecord/test/cases/adapters/mysql2/datetime_precision_quoting_test.rb index 86e72c149c..c131a5169c 100644 --- a/activerecord/test/cases/adapters/mysql2/datetime_precision_quoting_test.rb +++ b/activerecord/test/cases/adapters/mysql2/datetime_precision_quoting_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class Mysql2DatetimePrecisionQuotingTest < ActiveRecord::Mysql2TestCase diff --git a/activerecord/test/cases/adapters/mysql2/enum_test.rb b/activerecord/test/cases/adapters/mysql2/enum_test.rb index b811179c1b..7ad3e3ca2d 100644 --- a/activerecord/test/cases/adapters/mysql2/enum_test.rb +++ b/activerecord/test/cases/adapters/mysql2/enum_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class Mysql2EnumTest < ActiveRecord::Mysql2TestCase diff --git a/activerecord/test/cases/adapters/mysql2/explain_test.rb b/activerecord/test/cases/adapters/mysql2/explain_test.rb index 84c15af08d..7916921e5a 100644 --- a/activerecord/test/cases/adapters/mysql2/explain_test.rb +++ b/activerecord/test/cases/adapters/mysql2/explain_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/computer" diff --git a/activerecord/test/cases/adapters/mysql2/json_test.rb b/activerecord/test/cases/adapters/mysql2/json_test.rb index 2d39db4ce2..26c69edc7b 100644 --- a/activerecord/test/cases/adapters/mysql2/json_test.rb +++ b/activerecord/test/cases/adapters/mysql2/json_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "cases/json_shared_test_cases" diff --git a/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb b/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb index 7ba388bee1..565130c38f 100644 --- a/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb +++ b/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/ddl_helper" diff --git a/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb b/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb index 4a421e2b91..251a50e41e 100644 --- a/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb +++ b/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class SchemaMigrationsTest < ActiveRecord::Mysql2TestCase diff --git a/activerecord/test/cases/adapters/mysql2/schema_test.rb b/activerecord/test/cases/adapters/mysql2/schema_test.rb index c4bf58c13e..1fad5585de 100644 --- a/activerecord/test/cases/adapters/mysql2/schema_test.rb +++ b/activerecord/test/cases/adapters/mysql2/schema_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/adapters/mysql2/sp_test.rb b/activerecord/test/cases/adapters/mysql2/sp_test.rb index d4c4d02f79..4182532535 100644 --- a/activerecord/test/cases/adapters/mysql2/sp_test.rb +++ b/activerecord/test/cases/adapters/mysql2/sp_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/cases/adapters/mysql2/sql_types_test.rb b/activerecord/test/cases/adapters/mysql2/sql_types_test.rb index c412166451..d6e7f29a5c 100644 --- a/activerecord/test/cases/adapters/mysql2/sql_types_test.rb +++ b/activerecord/test/cases/adapters/mysql2/sql_types_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class Mysql2SqlTypesTest < ActiveRecord::Mysql2TestCase diff --git a/activerecord/test/cases/adapters/mysql2/table_options_test.rb b/activerecord/test/cases/adapters/mysql2/table_options_test.rb index 54da2195d1..61a8ce9bc0 100644 --- a/activerecord/test/cases/adapters/mysql2/table_options_test.rb +++ b/activerecord/test/cases/adapters/mysql2/table_options_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/mysql2/transaction_test.rb b/activerecord/test/cases/adapters/mysql2/transaction_test.rb index e447e6ec83..16101e38cb 100644 --- a/activerecord/test/cases/adapters/mysql2/transaction_test.rb +++ b/activerecord/test/cases/adapters/mysql2/transaction_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/mysql2/unsigned_type_test.rb b/activerecord/test/cases/adapters/mysql2/unsigned_type_test.rb index 1703e8fef7..71dcfaa241 100644 --- a/activerecord/test/cases/adapters/mysql2/unsigned_type_test.rb +++ b/activerecord/test/cases/adapters/mysql2/unsigned_type_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb b/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb index 85e283bfe1..442a4fb7b5 100644 --- a/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb +++ b/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/active_schema_test.rb b/activerecord/test/cases/adapters/postgresql/active_schema_test.rb index 441e84a117..b787de8453 100644 --- a/activerecord/test/cases/adapters/postgresql/active_schema_test.rb +++ b/activerecord/test/cases/adapters/postgresql/active_schema_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class PostgresqlActiveSchemaTest < ActiveRecord::PostgreSQLTestCase diff --git a/activerecord/test/cases/adapters/postgresql/array_test.rb b/activerecord/test/cases/adapters/postgresql/array_test.rb index a642145726..121c62dadf 100644 --- a/activerecord/test/cases/adapters/postgresql/array_test.rb +++ b/activerecord/test/cases/adapters/postgresql/array_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/bit_string_test.rb b/activerecord/test/cases/adapters/postgresql/bit_string_test.rb index d7ed0aa8dd..7712e809a2 100644 --- a/activerecord/test/cases/adapters/postgresql/bit_string_test.rb +++ b/activerecord/test/cases/adapters/postgresql/bit_string_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/connection_helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/bytea_test.rb b/activerecord/test/cases/adapters/postgresql/bytea_test.rb index 39d76de770..65baed34e9 100644 --- a/activerecord/test/cases/adapters/postgresql/bytea_test.rb +++ b/activerecord/test/cases/adapters/postgresql/bytea_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb b/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb index b6db6e5e28..03b44feab6 100644 --- a/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb +++ b/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class PostgresqlCaseInsensitiveTest < ActiveRecord::PostgreSQLTestCase diff --git a/activerecord/test/cases/adapters/postgresql/change_schema_test.rb b/activerecord/test/cases/adapters/postgresql/change_schema_test.rb index 9d7fddfc02..ea642069d2 100644 --- a/activerecord/test/cases/adapters/postgresql/change_schema_test.rb +++ b/activerecord/test/cases/adapters/postgresql/change_schema_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/adapters/postgresql/cidr_test.rb b/activerecord/test/cases/adapters/postgresql/cidr_test.rb index fccd8b3c7b..52f2a0096c 100644 --- a/activerecord/test/cases/adapters/postgresql/cidr_test.rb +++ b/activerecord/test/cases/adapters/postgresql/cidr_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "ipaddr" diff --git a/activerecord/test/cases/adapters/postgresql/citext_test.rb b/activerecord/test/cases/adapters/postgresql/citext_test.rb index ffdd2983c6..ca95e4b626 100644 --- a/activerecord/test/cases/adapters/postgresql/citext_test.rb +++ b/activerecord/test/cases/adapters/postgresql/citext_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/collation_test.rb b/activerecord/test/cases/adapters/postgresql/collation_test.rb index 2929c9ad94..a603221d8f 100644 --- a/activerecord/test/cases/adapters/postgresql/collation_test.rb +++ b/activerecord/test/cases/adapters/postgresql/collation_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/composite_test.rb b/activerecord/test/cases/adapters/postgresql/composite_test.rb index 9eb422a8a3..1da2a9e2ac 100644 --- a/activerecord/test/cases/adapters/postgresql/composite_test.rb +++ b/activerecord/test/cases/adapters/postgresql/composite_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/postgresql/connection_test.rb b/activerecord/test/cases/adapters/postgresql/connection_test.rb index 3adae7e146..32afe331fa 100644 --- a/activerecord/test/cases/adapters/postgresql/connection_test.rb +++ b/activerecord/test/cases/adapters/postgresql/connection_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/postgresql/datatype_test.rb b/activerecord/test/cases/adapters/postgresql/datatype_test.rb index f947868898..0725fde5ae 100644 --- a/activerecord/test/cases/adapters/postgresql/datatype_test.rb +++ b/activerecord/test/cases/adapters/postgresql/datatype_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/ddl_helper" diff --git a/activerecord/test/cases/adapters/postgresql/domain_test.rb b/activerecord/test/cases/adapters/postgresql/domain_test.rb index b16e0f9265..f1eb8adb15 100644 --- a/activerecord/test/cases/adapters/postgresql/domain_test.rb +++ b/activerecord/test/cases/adapters/postgresql/domain_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/postgresql/enum_test.rb b/activerecord/test/cases/adapters/postgresql/enum_test.rb index 0f8ab8ab23..5e5a3158ba 100644 --- a/activerecord/test/cases/adapters/postgresql/enum_test.rb +++ b/activerecord/test/cases/adapters/postgresql/enum_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/postgresql/explain_test.rb b/activerecord/test/cases/adapters/postgresql/explain_test.rb index 8a0cf440fd..d79fbccf47 100644 --- a/activerecord/test/cases/adapters/postgresql/explain_test.rb +++ b/activerecord/test/cases/adapters/postgresql/explain_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/computer" diff --git a/activerecord/test/cases/adapters/postgresql/extension_migration_test.rb b/activerecord/test/cases/adapters/postgresql/extension_migration_test.rb index ba2b4e1fbf..b56c226763 100644 --- a/activerecord/test/cases/adapters/postgresql/extension_migration_test.rb +++ b/activerecord/test/cases/adapters/postgresql/extension_migration_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class PostgresqlExtensionMigrationTest < ActiveRecord::PostgreSQLTestCase diff --git a/activerecord/test/cases/adapters/postgresql/full_text_test.rb b/activerecord/test/cases/adapters/postgresql/full_text_test.rb index fa8aadd224..5ddfe32007 100644 --- a/activerecord/test/cases/adapters/postgresql/full_text_test.rb +++ b/activerecord/test/cases/adapters/postgresql/full_text_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/geometric_test.rb b/activerecord/test/cases/adapters/postgresql/geometric_test.rb index 34836b2421..3b6840a1c9 100644 --- a/activerecord/test/cases/adapters/postgresql/geometric_test.rb +++ b/activerecord/test/cases/adapters/postgresql/geometric_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/connection_helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/hstore_test.rb b/activerecord/test/cases/adapters/postgresql/hstore_test.rb index b547868b57..f9cce10fb8 100644 --- a/activerecord/test/cases/adapters/postgresql/hstore_test.rb +++ b/activerecord/test/cases/adapters/postgresql/hstore_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/infinity_test.rb b/activerecord/test/cases/adapters/postgresql/infinity_test.rb index df5c688881..b9e177e6ec 100644 --- a/activerecord/test/cases/adapters/postgresql/infinity_test.rb +++ b/activerecord/test/cases/adapters/postgresql/infinity_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class PostgresqlInfinityTest < ActiveRecord::PostgreSQLTestCase diff --git a/activerecord/test/cases/adapters/postgresql/integer_test.rb b/activerecord/test/cases/adapters/postgresql/integer_test.rb index 5557e869ad..b4e55964b9 100644 --- a/activerecord/test/cases/adapters/postgresql/integer_test.rb +++ b/activerecord/test/cases/adapters/postgresql/integer_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "active_support/core_ext/numeric/bytes" diff --git a/activerecord/test/cases/adapters/postgresql/json_test.rb b/activerecord/test/cases/adapters/postgresql/json_test.rb index 4438f349cc..6aa60630c2 100644 --- a/activerecord/test/cases/adapters/postgresql/json_test.rb +++ b/activerecord/test/cases/adapters/postgresql/json_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "cases/json_shared_test_cases" diff --git a/activerecord/test/cases/adapters/postgresql/ltree_test.rb b/activerecord/test/cases/adapters/postgresql/ltree_test.rb index 447d68316c..2b5ac1cac6 100644 --- a/activerecord/test/cases/adapters/postgresql/ltree_test.rb +++ b/activerecord/test/cases/adapters/postgresql/ltree_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/money_test.rb b/activerecord/test/cases/adapters/postgresql/money_test.rb index f5c50a80c2..ea060345a7 100644 --- a/activerecord/test/cases/adapters/postgresql/money_test.rb +++ b/activerecord/test/cases/adapters/postgresql/money_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/network_test.rb b/activerecord/test/cases/adapters/postgresql/network_test.rb index 2bbfb292c4..a33b0ef8a7 100644 --- a/activerecord/test/cases/adapters/postgresql/network_test.rb +++ b/activerecord/test/cases/adapters/postgresql/network_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/numbers_test.rb b/activerecord/test/cases/adapters/postgresql/numbers_test.rb index 82edf7db3f..bfb2b7c27a 100644 --- a/activerecord/test/cases/adapters/postgresql/numbers_test.rb +++ b/activerecord/test/cases/adapters/postgresql/numbers_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class PostgresqlNumberTest < ActiveRecord::PostgreSQLTestCase diff --git a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb index 7c7bb0a942..76e0ad60fe 100644 --- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb +++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/ddl_helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb b/activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb index 0120e33f70..8c62690866 100644 --- a/activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb +++ b/activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/computer" require "models/developer" diff --git a/activerecord/test/cases/adapters/postgresql/quoting_test.rb b/activerecord/test/cases/adapters/postgresql/quoting_test.rb index 1205559558..a1e966b915 100644 --- a/activerecord/test/cases/adapters/postgresql/quoting_test.rb +++ b/activerecord/test/cases/adapters/postgresql/quoting_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/adapters/postgresql/range_test.rb b/activerecord/test/cases/adapters/postgresql/range_test.rb index 8de162a8a1..f411884dfd 100644 --- a/activerecord/test/cases/adapters/postgresql/range_test.rb +++ b/activerecord/test/cases/adapters/postgresql/range_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb b/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb index 0b17c141c8..0ff04bfa27 100644 --- a/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb +++ b/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/adapters/postgresql/rename_table_test.rb b/activerecord/test/cases/adapters/postgresql/rename_table_test.rb index 5b253999d5..e9e7f717ac 100644 --- a/activerecord/test/cases/adapters/postgresql/rename_table_test.rb +++ b/activerecord/test/cases/adapters/postgresql/rename_table_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class PostgresqlRenameTableTest < ActiveRecord::PostgreSQLTestCase diff --git a/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb b/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb index db7d8ba751..f86a76e08a 100644 --- a/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb +++ b/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class SchemaThing < ActiveRecord::Base diff --git a/activerecord/test/cases/adapters/postgresql/schema_test.rb b/activerecord/test/cases/adapters/postgresql/schema_test.rb index 5438665d42..f6b957476b 100644 --- a/activerecord/test/cases/adapters/postgresql/schema_test.rb +++ b/activerecord/test/cases/adapters/postgresql/schema_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/default" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/serial_test.rb b/activerecord/test/cases/adapters/postgresql/serial_test.rb index 4930d3f67a..d711b3b729 100644 --- a/activerecord/test/cases/adapters/postgresql/serial_test.rb +++ b/activerecord/test/cases/adapters/postgresql/serial_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb b/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb index 73cf91425b..146b619a4b 100644 --- a/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb +++ b/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/adapters/postgresql/timestamp_test.rb b/activerecord/test/cases/adapters/postgresql/timestamp_test.rb index c7dec25f3a..962450aada 100644 --- a/activerecord/test/cases/adapters/postgresql/timestamp_test.rb +++ b/activerecord/test/cases/adapters/postgresql/timestamp_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/topic" diff --git a/activerecord/test/cases/adapters/postgresql/transaction_test.rb b/activerecord/test/cases/adapters/postgresql/transaction_test.rb index c1b19c11f5..9b42d0383d 100644 --- a/activerecord/test/cases/adapters/postgresql/transaction_test.rb +++ b/activerecord/test/cases/adapters/postgresql/transaction_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/connection_helper" require "concurrent/atomic/cyclic_barrier" diff --git a/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb b/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb index 688117722b..784d77a8d1 100644 --- a/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb +++ b/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class PostgresqlTypeLookupTest < ActiveRecord::PostgreSQLTestCase diff --git a/activerecord/test/cases/adapters/postgresql/utils_test.rb b/activerecord/test/cases/adapters/postgresql/utils_test.rb index 1a655d7843..9f9e3bda2f 100644 --- a/activerecord/test/cases/adapters/postgresql/utils_test.rb +++ b/activerecord/test/cases/adapters/postgresql/utils_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "active_record/connection_adapters/postgresql/utils" diff --git a/activerecord/test/cases/adapters/postgresql/uuid_test.rb b/activerecord/test/cases/adapters/postgresql/uuid_test.rb index 49c570c917..8eddd81c38 100644 --- a/activerecord/test/cases/adapters/postgresql/uuid_test.rb +++ b/activerecord/test/cases/adapters/postgresql/uuid_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/postgresql/xml_test.rb b/activerecord/test/cases/adapters/postgresql/xml_test.rb index b0720b5a6e..826b384fb3 100644 --- a/activerecord/test/cases/adapters/postgresql/xml_test.rb +++ b/activerecord/test/cases/adapters/postgresql/xml_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/sqlite3/collation_test.rb b/activerecord/test/cases/adapters/sqlite3/collation_test.rb index f3cbb408f1..dd88ed3656 100644 --- a/activerecord/test/cases/adapters/sqlite3/collation_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/collation_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb b/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb index cc1f74ed41..e1cfd703e8 100644 --- a/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class CopyTableTest < ActiveRecord::SQLite3TestCase diff --git a/activerecord/test/cases/adapters/sqlite3/explain_test.rb b/activerecord/test/cases/adapters/sqlite3/explain_test.rb index a3f6299756..29d97ae78c 100644 --- a/activerecord/test/cases/adapters/sqlite3/explain_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/explain_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/computer" diff --git a/activerecord/test/cases/adapters/sqlite3/quoting_test.rb b/activerecord/test/cases/adapters/sqlite3/quoting_test.rb index 0a5bf7754c..aefbb309e6 100644 --- a/activerecord/test/cases/adapters/sqlite3/quoting_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/quoting_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "bigdecimal" require "securerandom" diff --git a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb index bc6605682c..cf0c37f70c 100644 --- a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/owner" require "tempfile" diff --git a/activerecord/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb b/activerecord/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb index d23a7ac532..b1b4463bf1 100644 --- a/activerecord/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/owner" diff --git a/activerecord/test/cases/adapters/sqlite3/statement_pool_test.rb b/activerecord/test/cases/adapters/sqlite3/statement_pool_test.rb index 76841c235a..37ff973397 100644 --- a/activerecord/test/cases/adapters/sqlite3/statement_pool_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/statement_pool_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class SQLite3StatementPoolTest < ActiveRecord::SQLite3TestCase diff --git a/activerecord/test/cases/aggregations_test.rb b/activerecord/test/cases/aggregations_test.rb index 97be9c447a..f8136fde72 100644 --- a/activerecord/test/cases/aggregations_test.rb +++ b/activerecord/test/cases/aggregations_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/customer" diff --git a/activerecord/test/cases/ar_schema_test.rb b/activerecord/test/cases/ar_schema_test.rb index aaae3736a9..5b608d8e83 100644 --- a/activerecord/test/cases/ar_schema_test.rb +++ b/activerecord/test/cases/ar_schema_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class ActiveRecordSchemaTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/associations/association_scope_test.rb b/activerecord/test/cases/associations/association_scope_test.rb index a57eb78a14..c54542ff7b 100644 --- a/activerecord/test/cases/associations/association_scope_test.rb +++ b/activerecord/test/cases/associations/association_scope_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/author" diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index af3f40974d..a727cc6e60 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/project" diff --git a/activerecord/test/cases/associations/bidirectional_destroy_dependencies_test.rb b/activerecord/test/cases/associations/bidirectional_destroy_dependencies_test.rb index eee327a0bc..8a0e041864 100644 --- a/activerecord/test/cases/associations/bidirectional_destroy_dependencies_test.rb +++ b/activerecord/test/cases/associations/bidirectional_destroy_dependencies_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/content" diff --git a/activerecord/test/cases/associations/callbacks_test.rb b/activerecord/test/cases/associations/callbacks_test.rb index b91fb5b7ed..f9d1e44595 100644 --- a/activerecord/test/cases/associations/callbacks_test.rb +++ b/activerecord/test/cases/associations/callbacks_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/author" diff --git a/activerecord/test/cases/associations/cascaded_eager_loading_test.rb b/activerecord/test/cases/associations/cascaded_eager_loading_test.rb index ea2582b507..7b0445025c 100644 --- a/activerecord/test/cases/associations/cascaded_eager_loading_test.rb +++ b/activerecord/test/cases/associations/cascaded_eager_loading_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb b/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb index f6de62b1af..61f39b4136 100644 --- a/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb +++ b/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/tagging" diff --git a/activerecord/test/cases/associations/eager_load_nested_include_test.rb b/activerecord/test/cases/associations/eager_load_nested_include_test.rb index 83c85cd022..e9f551b6b2 100644 --- a/activerecord/test/cases/associations/eager_load_nested_include_test.rb +++ b/activerecord/test/cases/associations/eager_load_nested_include_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/tag" diff --git a/activerecord/test/cases/associations/eager_singularization_test.rb b/activerecord/test/cases/associations/eager_singularization_test.rb index 860bb9ac54..16eff15026 100644 --- a/activerecord/test/cases/associations/eager_singularization_test.rb +++ b/activerecord/test/cases/associations/eager_singularization_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class EagerSingularizationTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index e0b137304b..55b294cfaa 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/tagging" diff --git a/activerecord/test/cases/associations/extension_test.rb b/activerecord/test/cases/associations/extension_test.rb index d2f21583a7..f707a170f5 100644 --- a/activerecord/test/cases/associations/extension_test.rb +++ b/activerecord/test/cases/associations/extension_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb index fa40bd2ff8..f73005b3cb 100644 --- a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/computer" diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 5ad1e2aecc..a7e16af88d 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/computer" diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb index 6794428688..1c2138a3d0 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/person" diff --git a/activerecord/test/cases/associations/has_one_associations_test.rb b/activerecord/test/cases/associations/has_one_associations_test.rb index 545eec7e5d..bf3b8dcd63 100644 --- a/activerecord/test/cases/associations/has_one_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_associations_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/computer" diff --git a/activerecord/test/cases/associations/has_one_through_associations_test.rb b/activerecord/test/cases/associations/has_one_through_associations_test.rb index 0a74a9e710..28b883586d 100644 --- a/activerecord/test/cases/associations/has_one_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_through_associations_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/club" require "models/member_type" diff --git a/activerecord/test/cases/associations/inner_join_association_test.rb b/activerecord/test/cases/associations/inner_join_association_test.rb index 6fff4171c8..ddf5bc6f0b 100644 --- a/activerecord/test/cases/associations/inner_join_association_test.rb +++ b/activerecord/test/cases/associations/inner_join_association_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/associations/inverse_associations_test.rb b/activerecord/test/cases/associations/inverse_associations_test.rb index 95ba6bdf8a..8e3087e7ca 100644 --- a/activerecord/test/cases/associations/inverse_associations_test.rb +++ b/activerecord/test/cases/associations/inverse_associations_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/man" require "models/face" diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb index c2758b30a1..c078cef064 100644 --- a/activerecord/test/cases/associations/join_model_test.rb +++ b/activerecord/test/cases/associations/join_model_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/tag" require "models/tagging" diff --git a/activerecord/test/cases/associations/left_outer_join_association_test.rb b/activerecord/test/cases/associations/left_outer_join_association_test.rb index 68c9286972..6d3757f467 100644 --- a/activerecord/test/cases/associations/left_outer_join_association_test.rb +++ b/activerecord/test/cases/associations/left_outer_join_association_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/associations/nested_through_associations_test.rb b/activerecord/test/cases/associations/nested_through_associations_test.rb index 90b2d4bc07..67ff7355b3 100644 --- a/activerecord/test/cases/associations/nested_through_associations_test.rb +++ b/activerecord/test/cases/associations/nested_through_associations_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/author" require "models/post" diff --git a/activerecord/test/cases/associations/required_test.rb b/activerecord/test/cases/associations/required_test.rb index 6cf2d8ac12..45e1803858 100644 --- a/activerecord/test/cases/associations/required_test.rb +++ b/activerecord/test/cases/associations/required_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class RequiredAssociationsTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb index ba2f4c11c8..2eb31326a5 100644 --- a/activerecord/test/cases/associations_test.rb +++ b/activerecord/test/cases/associations_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/computer" require "models/developer" diff --git a/activerecord/test/cases/attribute_decorators_test.rb b/activerecord/test/cases/attribute_decorators_test.rb index eb8efab6a5..cfa6ed1da6 100644 --- a/activerecord/test/cases/attribute_decorators_test.rb +++ b/activerecord/test/cases/attribute_decorators_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/attribute_methods/read_test.rb b/activerecord/test/cases/attribute_methods/read_test.rb index a366144e17..1fc63a49d4 100644 --- a/activerecord/test/cases/attribute_methods/read_test.rb +++ b/activerecord/test/cases/attribute_methods/read_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index 1f3a3652d7..4d24a980dc 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/minimalistic" require "models/developer" diff --git a/activerecord/test/cases/attribute_set_test.rb b/activerecord/test/cases/attribute_set_test.rb index 80c67f171b..bd4b200735 100644 --- a/activerecord/test/cases/attribute_set_test.rb +++ b/activerecord/test/cases/attribute_set_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/attribute_test.rb b/activerecord/test/cases/attribute_test.rb index ed9fb1b57b..e856d551c0 100644 --- a/activerecord/test/cases/attribute_test.rb +++ b/activerecord/test/cases/attribute_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/attributes_test.rb b/activerecord/test/cases/attributes_test.rb index 8aa515fe6e..3705a6be89 100644 --- a/activerecord/test/cases/attributes_test.rb +++ b/activerecord/test/cases/attributes_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class OverloadedType < ActiveRecord::Base diff --git a/activerecord/test/cases/autosave_association_test.rb b/activerecord/test/cases/autosave_association_test.rb index db2a19ea62..2203aa1788 100644 --- a/activerecord/test/cases/autosave_association_test.rb +++ b/activerecord/test/cases/autosave_association_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/bird" require "models/post" diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index a26a4bbb61..dc32e995a4 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/author" diff --git a/activerecord/test/cases/batches_test.rb b/activerecord/test/cases/batches_test.rb index beae679542..1a66b82b2e 100644 --- a/activerecord/test/cases/batches_test.rb +++ b/activerecord/test/cases/batches_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/subscriber" diff --git a/activerecord/test/cases/binary_test.rb b/activerecord/test/cases/binary_test.rb index 89301563f9..f6ac7990d1 100644 --- a/activerecord/test/cases/binary_test.rb +++ b/activerecord/test/cases/binary_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" # Without using prepared statements, it makes no sense to test diff --git a/activerecord/test/cases/bind_parameter_test.rb b/activerecord/test/cases/bind_parameter_test.rb index 8504f586cc..5af44c27eb 100644 --- a/activerecord/test/cases/bind_parameter_test.rb +++ b/activerecord/test/cases/bind_parameter_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/author" diff --git a/activerecord/test/cases/cache_key_test.rb b/activerecord/test/cases/cache_key_test.rb index f0a1bb9e22..7b8264e6e8 100644 --- a/activerecord/test/cases/cache_key_test.rb +++ b/activerecord/test/cases/cache_key_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index 478b9fe742..80baaac30a 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/book" require "models/club" diff --git a/activerecord/test/cases/callbacks_test.rb b/activerecord/test/cases/callbacks_test.rb index 55deaa6947..b3c86586d0 100644 --- a/activerecord/test/cases/callbacks_test.rb +++ b/activerecord/test/cases/callbacks_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/developer" require "models/computer" diff --git a/activerecord/test/cases/clone_test.rb b/activerecord/test/cases/clone_test.rb index fa0f53676e..b89294c094 100644 --- a/activerecord/test/cases/clone_test.rb +++ b/activerecord/test/cases/clone_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" diff --git a/activerecord/test/cases/coders/json_test.rb b/activerecord/test/cases/coders/json_test.rb index 95e6fb3e7b..d22d93d129 100644 --- a/activerecord/test/cases/coders/json_test.rb +++ b/activerecord/test/cases/coders/json_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/coders/yaml_column_test.rb b/activerecord/test/cases/coders/yaml_column_test.rb index e3e85a58a4..a26a72712d 100644 --- a/activerecord/test/cases/coders/yaml_column_test.rb +++ b/activerecord/test/cases/coders/yaml_column_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/collection_cache_key_test.rb b/activerecord/test/cases/collection_cache_key_test.rb index 2d10a68416..f344c77691 100644 --- a/activerecord/test/cases/collection_cache_key_test.rb +++ b/activerecord/test/cases/collection_cache_key_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/computer" require "models/developer" diff --git a/activerecord/test/cases/column_alias_test.rb b/activerecord/test/cases/column_alias_test.rb index 506ae05756..9893ba9580 100644 --- a/activerecord/test/cases/column_alias_test.rb +++ b/activerecord/test/cases/column_alias_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" diff --git a/activerecord/test/cases/column_definition_test.rb b/activerecord/test/cases/column_definition_test.rb index fcb0952c1c..90c8d21c43 100644 --- a/activerecord/test/cases/column_definition_test.rb +++ b/activerecord/test/cases/column_definition_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/comment_test.rb b/activerecord/test/cases/comment_test.rb index 5c91ac347c..c23be52a6c 100644 --- a/activerecord/test/cases/comment_test.rb +++ b/activerecord/test/cases/comment_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/connection_adapters/adapter_leasing_test.rb b/activerecord/test/cases/connection_adapters/adapter_leasing_test.rb index 4f88b129af..64189381cb 100644 --- a/activerecord/test/cases/connection_adapters/adapter_leasing_test.rb +++ b/activerecord/test/cases/connection_adapters/adapter_leasing_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/connection_adapters/connection_handler_test.rb b/activerecord/test/cases/connection_adapters/connection_handler_test.rb index f8725ddb01..2a71f08d90 100644 --- a/activerecord/test/cases/connection_adapters/connection_handler_test.rb +++ b/activerecord/test/cases/connection_adapters/connection_handler_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/connection_adapters/connection_specification_test.rb b/activerecord/test/cases/connection_adapters/connection_specification_test.rb index 40998c06bf..10a3521c79 100644 --- a/activerecord/test/cases/connection_adapters/connection_specification_test.rb +++ b/activerecord/test/cases/connection_adapters/connection_specification_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb b/activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb index 7c98c80e39..8faa67255d 100644 --- a/activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb +++ b/activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb b/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb index 133632bac9..3657b8340d 100644 --- a/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb +++ b/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" if current_adapter?(:Mysql2Adapter) diff --git a/activerecord/test/cases/connection_adapters/schema_cache_test.rb b/activerecord/test/cases/connection_adapters/schema_cache_test.rb index 3370818616..106323ccc9 100644 --- a/activerecord/test/cases/connection_adapters/schema_cache_test.rb +++ b/activerecord/test/cases/connection_adapters/schema_cache_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/connection_adapters/type_lookup_test.rb b/activerecord/test/cases/connection_adapters/type_lookup_test.rb index 251483da44..a348c2d783 100644 --- a/activerecord/test/cases/connection_adapters/type_lookup_test.rb +++ b/activerecord/test/cases/connection_adapters/type_lookup_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" unless current_adapter?(:PostgreSQLAdapter) # PostgreSQL does not use type strings for lookup diff --git a/activerecord/test/cases/connection_management_test.rb b/activerecord/test/cases/connection_management_test.rb index 9bd0aab981..d1e946d401 100644 --- a/activerecord/test/cases/connection_management_test.rb +++ b/activerecord/test/cases/connection_management_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "rack" diff --git a/activerecord/test/cases/connection_pool_test.rb b/activerecord/test/cases/connection_pool_test.rb index adbd158e7a..00a0187b57 100644 --- a/activerecord/test/cases/connection_pool_test.rb +++ b/activerecord/test/cases/connection_pool_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "concurrent/atomic/count_down_latch" diff --git a/activerecord/test/cases/connection_specification/resolver_test.rb b/activerecord/test/cases/connection_specification/resolver_test.rb index 3d97281627..13b5bae13c 100644 --- a/activerecord/test/cases/connection_specification/resolver_test.rb +++ b/activerecord/test/cases/connection_specification/resolver_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/core_test.rb b/activerecord/test/cases/core_test.rb index 5cf962c39d..936f26ce04 100644 --- a/activerecord/test/cases/core_test.rb +++ b/activerecord/test/cases/core_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/person" require "models/topic" diff --git a/activerecord/test/cases/counter_cache_test.rb b/activerecord/test/cases/counter_cache_test.rb index 14800e6b91..46d7526cc0 100644 --- a/activerecord/test/cases/counter_cache_test.rb +++ b/activerecord/test/cases/counter_cache_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/car" diff --git a/activerecord/test/cases/custom_locking_test.rb b/activerecord/test/cases/custom_locking_test.rb index e170843952..15c8b684e4 100644 --- a/activerecord/test/cases/custom_locking_test.rb +++ b/activerecord/test/cases/custom_locking_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/person" diff --git a/activerecord/test/cases/database_statements_test.rb b/activerecord/test/cases/database_statements_test.rb index 5df028d397..66035865be 100644 --- a/activerecord/test/cases/database_statements_test.rb +++ b/activerecord/test/cases/database_statements_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class DatabaseStatementsTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/date_test.rb b/activerecord/test/cases/date_test.rb index 202100ff69..2edc0415cd 100644 --- a/activerecord/test/cases/date_test.rb +++ b/activerecord/test/cases/date_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" diff --git a/activerecord/test/cases/date_time_precision_test.rb b/activerecord/test/cases/date_time_precision_test.rb index 12b1858991..e4a2f9ee17 100644 --- a/activerecord/test/cases/date_time_precision_test.rb +++ b/activerecord/test/cases/date_time_precision_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/date_time_test.rb b/activerecord/test/cases/date_time_test.rb index 8753c95641..ad7da9de70 100644 --- a/activerecord/test/cases/date_time_test.rb +++ b/activerecord/test/cases/date_time_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/task" diff --git a/activerecord/test/cases/defaults_test.rb b/activerecord/test/cases/defaults_test.rb index 30cfa0744f..996d298689 100644 --- a/activerecord/test/cases/defaults_test.rb +++ b/activerecord/test/cases/defaults_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" require "models/default" diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb index cc2724502b..f72e0d2ead 100644 --- a/activerecord/test/cases/dirty_test.rb +++ b/activerecord/test/cases/dirty_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" # For booleans require "models/pirate" # For timestamps diff --git a/activerecord/test/cases/disconnected_test.rb b/activerecord/test/cases/disconnected_test.rb index 92365351b1..c25089a420 100644 --- a/activerecord/test/cases/disconnected_test.rb +++ b/activerecord/test/cases/disconnected_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class TestRecord < ActiveRecord::Base diff --git a/activerecord/test/cases/dup_test.rb b/activerecord/test/cases/dup_test.rb index 76979dc798..000ed27efb 100644 --- a/activerecord/test/cases/dup_test.rb +++ b/activerecord/test/cases/dup_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/reply" require "models/topic" diff --git a/activerecord/test/cases/enum_test.rb b/activerecord/test/cases/enum_test.rb index 8e13582f3e..4ef9a125e6 100644 --- a/activerecord/test/cases/enum_test.rb +++ b/activerecord/test/cases/enum_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/author" require "models/book" diff --git a/activerecord/test/cases/errors_test.rb b/activerecord/test/cases/errors_test.rb index 45e28c4f03..e90669e0c7 100644 --- a/activerecord/test/cases/errors_test.rb +++ b/activerecord/test/cases/errors_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class ErrorsTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/explain_subscriber_test.rb b/activerecord/test/cases/explain_subscriber_test.rb index 0fb6bf2eed..ca87e04012 100644 --- a/activerecord/test/cases/explain_subscriber_test.rb +++ b/activerecord/test/cases/explain_subscriber_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "active_record/explain_subscriber" require "active_record/explain_registry" diff --git a/activerecord/test/cases/explain_test.rb b/activerecord/test/cases/explain_test.rb index de3ec36667..4f6bd9327c 100644 --- a/activerecord/test/cases/explain_test.rb +++ b/activerecord/test/cases/explain_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/car" require "active_support/core_ext/string/strip" diff --git a/activerecord/test/cases/finder_respond_to_test.rb b/activerecord/test/cases/finder_respond_to_test.rb index 29d7dee343..3eaa993d45 100644 --- a/activerecord/test/cases/finder_respond_to_test.rb +++ b/activerecord/test/cases/finder_respond_to_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index 752ac519a4..420f552ef6 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/author" diff --git a/activerecord/test/cases/fixture_set/file_test.rb b/activerecord/test/cases/fixture_set/file_test.rb index c7058133b2..533edcc2e0 100644 --- a/activerecord/test/cases/fixture_set/file_test.rb +++ b/activerecord/test/cases/fixture_set/file_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "tempfile" diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb index 91d0908450..b499e60922 100644 --- a/activerecord/test/cases/fixtures_test.rb +++ b/activerecord/test/cases/fixtures_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/admin" require "models/admin/account" diff --git a/activerecord/test/cases/forbidden_attributes_protection_test.rb b/activerecord/test/cases/forbidden_attributes_protection_test.rb index d11ec08dea..ffa3f63e0d 100644 --- a/activerecord/test/cases/forbidden_attributes_protection_test.rb +++ b/activerecord/test/cases/forbidden_attributes_protection_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "active_support/core_ext/hash/indifferent_access" diff --git a/activerecord/test/cases/habtm_destroy_order_test.rb b/activerecord/test/cases/habtm_destroy_order_test.rb index 124e3216d0..365d4576dd 100644 --- a/activerecord/test/cases/habtm_destroy_order_test.rb +++ b/activerecord/test/cases/habtm_destroy_order_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/lesson" require "models/student" diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 84a784e6d5..5a3b8e3fb5 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "config" require "stringio" diff --git a/activerecord/test/cases/hot_compatibility_test.rb b/activerecord/test/cases/hot_compatibility_test.rb index 970ccc3601..e107ff2362 100644 --- a/activerecord/test/cases/hot_compatibility_test.rb +++ b/activerecord/test/cases/hot_compatibility_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/connection_helper" diff --git a/activerecord/test/cases/i18n_test.rb b/activerecord/test/cases/i18n_test.rb index 94b5e4ef2f..7f03c5b23d 100644 --- a/activerecord/test/cases/i18n_test.rb +++ b/activerecord/test/cases/i18n_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb index e73d9d0a27..fb5a7bcc31 100644 --- a/activerecord/test/cases/inheritance_test.rb +++ b/activerecord/test/cases/inheritance_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/author" require "models/company" diff --git a/activerecord/test/cases/integration_test.rb b/activerecord/test/cases/integration_test.rb index 1075366fb1..9104976126 100644 --- a/activerecord/test/cases/integration_test.rb +++ b/activerecord/test/cases/integration_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/company" require "models/developer" diff --git a/activerecord/test/cases/invalid_connection_test.rb b/activerecord/test/cases/invalid_connection_test.rb index 256ad59407..1367af2859 100644 --- a/activerecord/test/cases/invalid_connection_test.rb +++ b/activerecord/test/cases/invalid_connection_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" if current_adapter?(:Mysql2Adapter) diff --git a/activerecord/test/cases/invertible_migration_test.rb b/activerecord/test/cases/invertible_migration_test.rb index a44a351209..cc3951e2ba 100644 --- a/activerecord/test/cases/invertible_migration_test.rb +++ b/activerecord/test/cases/invertible_migration_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class Horse < ActiveRecord::Base diff --git a/activerecord/test/cases/json_attribute_test.rb b/activerecord/test/cases/json_attribute_test.rb index c64e2c31de..e5848b45f8 100644 --- a/activerecord/test/cases/json_attribute_test.rb +++ b/activerecord/test/cases/json_attribute_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "cases/json_shared_test_cases" diff --git a/activerecord/test/cases/json_serialization_test.rb b/activerecord/test/cases/json_serialization_test.rb index 2ca95fe3b4..9b4b61b16e 100644 --- a/activerecord/test/cases/json_serialization_test.rb +++ b/activerecord/test/cases/json_serialization_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/contact" require "models/post" diff --git a/activerecord/test/cases/json_shared_test_cases.rb b/activerecord/test/cases/json_shared_test_cases.rb index 1eeefb78dd..9a1c1c3f3f 100644 --- a/activerecord/test/cases/json_shared_test_cases.rb +++ b/activerecord/test/cases/json_shared_test_cases.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "support/schema_dumping_helper" module JSONSharedTestCases diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb index e67ec22c42..2fc52393f2 100644 --- a/activerecord/test/cases/locking_test.rb +++ b/activerecord/test/cases/locking_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "thread" require "cases/helper" require "models/person" diff --git a/activerecord/test/cases/log_subscriber_test.rb b/activerecord/test/cases/log_subscriber_test.rb index 0eaca0d001..b80257962c 100644 --- a/activerecord/test/cases/log_subscriber_test.rb +++ b/activerecord/test/cases/log_subscriber_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/binary" require "models/developer" diff --git a/activerecord/test/cases/migration/change_schema_test.rb b/activerecord/test/cases/migration/change_schema_test.rb index e706fc4f08..1d305fa11f 100644 --- a/activerecord/test/cases/migration/change_schema_test.rb +++ b/activerecord/test/cases/migration/change_schema_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/change_table_test.rb b/activerecord/test/cases/migration/change_table_test.rb index f1ca91887b..ec817a579b 100644 --- a/activerecord/test/cases/migration/change_table_test.rb +++ b/activerecord/test/cases/migration/change_table_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/migration/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/column_attributes_test.rb b/activerecord/test/cases/migration/column_attributes_test.rb index 5ef0847a64..48df931543 100644 --- a/activerecord/test/cases/migration/column_attributes_test.rb +++ b/activerecord/test/cases/migration/column_attributes_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/migration/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/column_positioning_test.rb b/activerecord/test/cases/migration/column_positioning_test.rb index bdbad431e8..f2162d91b1 100644 --- a/activerecord/test/cases/migration/column_positioning_test.rb +++ b/activerecord/test/cases/migration/column_positioning_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/columns_test.rb b/activerecord/test/cases/migration/columns_test.rb index c4751277f7..2329888345 100644 --- a/activerecord/test/cases/migration/columns_test.rb +++ b/activerecord/test/cases/migration/columns_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/migration/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/command_recorder_test.rb b/activerecord/test/cases/migration/command_recorder_test.rb index be200a7225..007926f1b9 100644 --- a/activerecord/test/cases/migration/command_recorder_test.rb +++ b/activerecord/test/cases/migration/command_recorder_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/compatibility_test.rb b/activerecord/test/cases/migration/compatibility_test.rb index 4321f967d2..596a21dcbc 100644 --- a/activerecord/test/cases/migration/compatibility_test.rb +++ b/activerecord/test/cases/migration/compatibility_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/migration/create_join_table_test.rb b/activerecord/test/cases/migration/create_join_table_test.rb index 0e9e880fe1..c4896f3d6e 100644 --- a/activerecord/test/cases/migration/create_join_table_test.rb +++ b/activerecord/test/cases/migration/create_join_table_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/foreign_key_test.rb b/activerecord/test/cases/migration/foreign_key_test.rb index 7a44b2db75..7762d37915 100644 --- a/activerecord/test/cases/migration/foreign_key_test.rb +++ b/activerecord/test/cases/migration/foreign_key_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/migration/helper.rb b/activerecord/test/cases/migration/helper.rb index e366ed92b1..9c0fa7339d 100644 --- a/activerecord/test/cases/migration/helper.rb +++ b/activerecord/test/cases/migration/helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/index_test.rb b/activerecord/test/cases/migration/index_test.rb index ccc0f4948f..f10fcf1398 100644 --- a/activerecord/test/cases/migration/index_test.rb +++ b/activerecord/test/cases/migration/index_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/logger_test.rb b/activerecord/test/cases/migration/logger_test.rb index 9fe64b73a8..3d7c7ad469 100644 --- a/activerecord/test/cases/migration/logger_test.rb +++ b/activerecord/test/cases/migration/logger_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/pending_migrations_test.rb b/activerecord/test/cases/migration/pending_migrations_test.rb index 0cb4b6cfa1..6970fdcc87 100644 --- a/activerecord/test/cases/migration/pending_migrations_test.rb +++ b/activerecord/test/cases/migration/pending_migrations_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/references_foreign_key_test.rb b/activerecord/test/cases/migration/references_foreign_key_test.rb index 405fd7aaed..718b9a0613 100644 --- a/activerecord/test/cases/migration/references_foreign_key_test.rb +++ b/activerecord/test/cases/migration/references_foreign_key_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" if ActiveRecord::Base.connection.supports_foreign_keys_in_create? diff --git a/activerecord/test/cases/migration/references_index_test.rb b/activerecord/test/cases/migration/references_index_test.rb index 2954f1e275..2866cabab6 100644 --- a/activerecord/test/cases/migration/references_index_test.rb +++ b/activerecord/test/cases/migration/references_index_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/references_statements_test.rb b/activerecord/test/cases/migration/references_statements_test.rb index f8b373bdee..e9eb9968cb 100644 --- a/activerecord/test/cases/migration/references_statements_test.rb +++ b/activerecord/test/cases/migration/references_statements_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/migration/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration/rename_table_test.rb b/activerecord/test/cases/migration/rename_table_test.rb index bee528ca8a..5da3ad33a3 100644 --- a/activerecord/test/cases/migration/rename_table_test.rb +++ b/activerecord/test/cases/migration/rename_table_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/migration/helper" module ActiveRecord diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index 315e58668a..3a49a41580 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "cases/migration/helper" require "bigdecimal/util" diff --git a/activerecord/test/cases/migrator_test.rb b/activerecord/test/cases/migrator_test.rb index b93643922d..2e4b454a86 100644 --- a/activerecord/test/cases/migrator_test.rb +++ b/activerecord/test/cases/migrator_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "cases/migration/helper" diff --git a/activerecord/test/cases/mixin_test.rb b/activerecord/test/cases/mixin_test.rb index 82190c283e..a8af8e30f7 100644 --- a/activerecord/test/cases/mixin_test.rb +++ b/activerecord/test/cases/mixin_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class Mixin < ActiveRecord::Base diff --git a/activerecord/test/cases/modules_test.rb b/activerecord/test/cases/modules_test.rb index 514911cb13..f8a7bab35f 100644 --- a/activerecord/test/cases/modules_test.rb +++ b/activerecord/test/cases/modules_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/company_in_module" require "models/shop" diff --git a/activerecord/test/cases/multiparameter_attributes_test.rb b/activerecord/test/cases/multiparameter_attributes_test.rb index 7a35b5dc84..ceb5724377 100644 --- a/activerecord/test/cases/multiparameter_attributes_test.rb +++ b/activerecord/test/cases/multiparameter_attributes_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/customer" diff --git a/activerecord/test/cases/multiple_db_test.rb b/activerecord/test/cases/multiple_db_test.rb index bfa5da765b..e3bb51bd77 100644 --- a/activerecord/test/cases/multiple_db_test.rb +++ b/activerecord/test/cases/multiple_db_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/entrant" require "models/bird" diff --git a/activerecord/test/cases/nested_attributes_test.rb b/activerecord/test/cases/nested_attributes_test.rb index aea65a7baf..154faa56aa 100644 --- a/activerecord/test/cases/nested_attributes_test.rb +++ b/activerecord/test/cases/nested_attributes_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/pirate" require "models/ship" diff --git a/activerecord/test/cases/nested_attributes_with_callbacks_test.rb b/activerecord/test/cases/nested_attributes_with_callbacks_test.rb index 905ddef063..b9d2acbed2 100644 --- a/activerecord/test/cases/nested_attributes_with_callbacks_test.rb +++ b/activerecord/test/cases/nested_attributes_with_callbacks_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/pirate" require "models/bird" diff --git a/activerecord/test/cases/numeric_data_test.rb b/activerecord/test/cases/numeric_data_test.rb index b0a3d566bb..76b97033af 100644 --- a/activerecord/test/cases/numeric_data_test.rb +++ b/activerecord/test/cases/numeric_data_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/numeric_data" diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb index 8f0099ee48..5895c51714 100644 --- a/activerecord/test/cases/persistence_test.rb +++ b/activerecord/test/cases/persistence_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/aircraft" require "models/post" diff --git a/activerecord/test/cases/pooled_connections_test.rb b/activerecord/test/cases/pooled_connections_test.rb index d99318f1aa..f1b0d08765 100644 --- a/activerecord/test/cases/pooled_connections_test.rb +++ b/activerecord/test/cases/pooled_connections_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/project" require "timeout" diff --git a/activerecord/test/cases/primary_keys_test.rb b/activerecord/test/cases/primary_keys_test.rb index 61cd6b45a1..56229b70bc 100644 --- a/activerecord/test/cases/primary_keys_test.rb +++ b/activerecord/test/cases/primary_keys_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" require "models/topic" diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb index fb5305d288..b018a7b6c0 100644 --- a/activerecord/test/cases/query_cache_test.rb +++ b/activerecord/test/cases/query_cache_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/task" diff --git a/activerecord/test/cases/quoting_test.rb b/activerecord/test/cases/quoting_test.rb index 4cfad9c21f..0819776fbf 100644 --- a/activerecord/test/cases/quoting_test.rb +++ b/activerecord/test/cases/quoting_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/readonly_test.rb b/activerecord/test/cases/readonly_test.rb index 2e8d108985..24b678310d 100644 --- a/activerecord/test/cases/readonly_test.rb +++ b/activerecord/test/cases/readonly_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/author" require "models/post" diff --git a/activerecord/test/cases/reaper_test.rb b/activerecord/test/cases/reaper_test.rb index 153311bece..249878b67d 100644 --- a/activerecord/test/cases/reaper_test.rb +++ b/activerecord/test/cases/reaper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/reflection_test.rb b/activerecord/test/cases/reflection_test.rb index e27000472c..c1c2efb9c8 100644 --- a/activerecord/test/cases/reflection_test.rb +++ b/activerecord/test/cases/reflection_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/customer" diff --git a/activerecord/test/cases/relation/delegation_test.rb b/activerecord/test/cases/relation/delegation_test.rb index 5945eab75a..3b15f051b2 100644 --- a/activerecord/test/cases/relation/delegation_test.rb +++ b/activerecord/test/cases/relation/delegation_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/relation/merging_test.rb b/activerecord/test/cases/relation/merging_test.rb index feb5604284..3901824aac 100644 --- a/activerecord/test/cases/relation/merging_test.rb +++ b/activerecord/test/cases/relation/merging_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/author" require "models/comment" diff --git a/activerecord/test/cases/relation/mutation_test.rb b/activerecord/test/cases/relation/mutation_test.rb index 113ddaa780..dea787c07f 100644 --- a/activerecord/test/cases/relation/mutation_test.rb +++ b/activerecord/test/cases/relation/mutation_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" diff --git a/activerecord/test/cases/relation/or_test.rb b/activerecord/test/cases/relation/or_test.rb index 541feabeb6..61b6601580 100644 --- a/activerecord/test/cases/relation/or_test.rb +++ b/activerecord/test/cases/relation/or_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" diff --git a/activerecord/test/cases/relation/predicate_builder_test.rb b/activerecord/test/cases/relation/predicate_builder_test.rb index 94cd704a14..48758dc148 100644 --- a/activerecord/test/cases/relation/predicate_builder_test.rb +++ b/activerecord/test/cases/relation/predicate_builder_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" diff --git a/activerecord/test/cases/relation/record_fetch_warning_test.rb b/activerecord/test/cases/relation/record_fetch_warning_test.rb index 59eb524f5a..62ca051431 100644 --- a/activerecord/test/cases/relation/record_fetch_warning_test.rb +++ b/activerecord/test/cases/relation/record_fetch_warning_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "active_record/relation/record_fetch_warning" diff --git a/activerecord/test/cases/relation/where_chain_test.rb b/activerecord/test/cases/relation/where_chain_test.rb index 351e955947..86e150ed79 100644 --- a/activerecord/test/cases/relation/where_chain_test.rb +++ b/activerecord/test/cases/relation/where_chain_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/relation/where_clause_test.rb b/activerecord/test/cases/relation/where_clause_test.rb index 59a7002774..f8eb0dee91 100644 --- a/activerecord/test/cases/relation/where_clause_test.rb +++ b/activerecord/test/cases/relation/where_clause_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class ActiveRecord::Relation diff --git a/activerecord/test/cases/relation/where_test.rb b/activerecord/test/cases/relation/where_test.rb index ac4fcfff1d..42dae4d569 100644 --- a/activerecord/test/cases/relation/where_test.rb +++ b/activerecord/test/cases/relation/where_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/author" require "models/binary" diff --git a/activerecord/test/cases/relation_test.rb b/activerecord/test/cases/relation_test.rb index f81b155657..a403824f1a 100644 --- a/activerecord/test/cases/relation_test.rb +++ b/activerecord/test/cases/relation_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index c804bbf3a5..5767dec315 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/tag" require "models/tagging" diff --git a/activerecord/test/cases/reload_models_test.rb b/activerecord/test/cases/reload_models_test.rb index 6c2f9fb5ab..3f4c0c03e3 100644 --- a/activerecord/test/cases/reload_models_test.rb +++ b/activerecord/test/cases/reload_models_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/owner" require "models/pet" diff --git a/activerecord/test/cases/reserved_word_test.rb b/activerecord/test/cases/reserved_word_test.rb index 44f7a28215..f3019a5326 100644 --- a/activerecord/test/cases/reserved_word_test.rb +++ b/activerecord/test/cases/reserved_word_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class ReservedWordTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/result_test.rb b/activerecord/test/cases/result_test.rb index b4044acd57..1a0b7c6ca7 100644 --- a/activerecord/test/cases/result_test.rb +++ b/activerecord/test/cases/result_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/sanitize_test.rb b/activerecord/test/cases/sanitize_test.rb index a0e7f4ae60..72f09186e2 100644 --- a/activerecord/test/cases/sanitize_test.rb +++ b/activerecord/test/cases/sanitize_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/binary" require "models/author" diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb index 86a0e93832..4c81e825fa 100644 --- a/activerecord/test/cases/schema_dumper_test.rb +++ b/activerecord/test/cases/schema_dumper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/schema_loading_test.rb b/activerecord/test/cases/schema_loading_test.rb index e3b7755f07..362370ac61 100644 --- a/activerecord/test/cases/schema_loading_test.rb +++ b/activerecord/test/cases/schema_loading_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module SchemaLoadCounter diff --git a/activerecord/test/cases/scoping/default_scoping_test.rb b/activerecord/test/cases/scoping/default_scoping_test.rb index 9919ed5e3f..89fb434b27 100644 --- a/activerecord/test/cases/scoping/default_scoping_test.rb +++ b/activerecord/test/cases/scoping/default_scoping_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/comment" diff --git a/activerecord/test/cases/scoping/named_scoping_test.rb b/activerecord/test/cases/scoping/named_scoping_test.rb index ea338a9847..483ea7128d 100644 --- a/activerecord/test/cases/scoping/named_scoping_test.rb +++ b/activerecord/test/cases/scoping/named_scoping_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/topic" diff --git a/activerecord/test/cases/scoping/relation_scoping_test.rb b/activerecord/test/cases/scoping/relation_scoping_test.rb index 644e7eb692..10553bf057 100644 --- a/activerecord/test/cases/scoping/relation_scoping_test.rb +++ b/activerecord/test/cases/scoping/relation_scoping_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/post" require "models/author" diff --git a/activerecord/test/cases/secure_token_test.rb b/activerecord/test/cases/secure_token_test.rb index 987ae3074f..7b9cbee40a 100644 --- a/activerecord/test/cases/secure_token_test.rb +++ b/activerecord/test/cases/secure_token_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/user" diff --git a/activerecord/test/cases/serialization_test.rb b/activerecord/test/cases/serialization_test.rb index 82e0311d84..ec33ad38f2 100644 --- a/activerecord/test/cases/serialization_test.rb +++ b/activerecord/test/cases/serialization_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/contact" require "models/topic" diff --git a/activerecord/test/cases/serialized_attribute_test.rb b/activerecord/test/cases/serialized_attribute_test.rb index 6525730350..e1bdaab5cf 100644 --- a/activerecord/test/cases/serialized_attribute_test.rb +++ b/activerecord/test/cases/serialized_attribute_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/cases/statement_cache_test.rb b/activerecord/test/cases/statement_cache_test.rb index ee1a8bfc36..fab3648564 100644 --- a/activerecord/test/cases/statement_cache_test.rb +++ b/activerecord/test/cases/statement_cache_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/book" require "models/liquid" diff --git a/activerecord/test/cases/store_test.rb b/activerecord/test/cases/store_test.rb index 0ece0632fe..633a8a0ebc 100644 --- a/activerecord/test/cases/store_test.rb +++ b/activerecord/test/cases/store_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/admin" require "models/admin/user" diff --git a/activerecord/test/cases/suppressor_test.rb b/activerecord/test/cases/suppressor_test.rb index bc85461322..a7d16b7cdb 100644 --- a/activerecord/test/cases/suppressor_test.rb +++ b/activerecord/test/cases/suppressor_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/notification" require "models/user" diff --git a/activerecord/test/cases/tasks/database_tasks_test.rb b/activerecord/test/cases/tasks/database_tasks_test.rb index b8280c4aaf..c47c97e9d9 100644 --- a/activerecord/test/cases/tasks/database_tasks_test.rb +++ b/activerecord/test/cases/tasks/database_tasks_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "active_record/tasks/database_tasks" diff --git a/activerecord/test/cases/tasks/mysql_rake_test.rb b/activerecord/test/cases/tasks/mysql_rake_test.rb index 02c0cfbb92..9c6fb14376 100644 --- a/activerecord/test/cases/tasks/mysql_rake_test.rb +++ b/activerecord/test/cases/tasks/mysql_rake_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "active_record/tasks/database_tasks" diff --git a/activerecord/test/cases/tasks/postgresql_rake_test.rb b/activerecord/test/cases/tasks/postgresql_rake_test.rb index 9369d1eedb..a2e968aedf 100644 --- a/activerecord/test/cases/tasks/postgresql_rake_test.rb +++ b/activerecord/test/cases/tasks/postgresql_rake_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "active_record/tasks/database_tasks" diff --git a/activerecord/test/cases/tasks/sqlite_rake_test.rb b/activerecord/test/cases/tasks/sqlite_rake_test.rb index 0deedad671..ccb3834fee 100644 --- a/activerecord/test/cases/tasks/sqlite_rake_test.rb +++ b/activerecord/test/cases/tasks/sqlite_rake_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "active_record/tasks/database_tasks" require "pathname" diff --git a/activerecord/test/cases/test_case.rb b/activerecord/test/cases/test_case.rb index 247d0ec3d1..9f594fef85 100644 --- a/activerecord/test/cases/test_case.rb +++ b/activerecord/test/cases/test_case.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/test_case" require "active_support/testing/autorun" require "active_support/testing/method_call_assertions" diff --git a/activerecord/test/cases/test_fixtures_test.rb b/activerecord/test/cases/test_fixtures_test.rb index e542716563..58d3bea3a2 100644 --- a/activerecord/test/cases/test_fixtures_test.rb +++ b/activerecord/test/cases/test_fixtures_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class TestFixturesTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/time_precision_test.rb b/activerecord/test/cases/time_precision_test.rb index 3a8f8af0e6..09c585167e 100644 --- a/activerecord/test/cases/time_precision_test.rb +++ b/activerecord/test/cases/time_precision_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/timestamp_test.rb b/activerecord/test/cases/timestamp_test.rb index 0f58c96504..39b40e3411 100644 --- a/activerecord/test/cases/timestamp_test.rb +++ b/activerecord/test/cases/timestamp_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "support/ddl_helper" require "models/developer" diff --git a/activerecord/test/cases/touch_later_test.rb b/activerecord/test/cases/touch_later_test.rb index 24b5e8886f..d1e8c649d9 100644 --- a/activerecord/test/cases/touch_later_test.rb +++ b/activerecord/test/cases/touch_later_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/invoice" require "models/line_item" diff --git a/activerecord/test/cases/transaction_callbacks_test.rb b/activerecord/test/cases/transaction_callbacks_test.rb index aa0d8f5e65..eaa4dd09a9 100644 --- a/activerecord/test/cases/transaction_callbacks_test.rb +++ b/activerecord/test/cases/transaction_callbacks_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/owner" require "models/pet" diff --git a/activerecord/test/cases/transaction_isolation_test.rb b/activerecord/test/cases/transaction_isolation_test.rb index 380d7dbb0a..58abfadaf4 100644 --- a/activerecord/test/cases/transaction_isolation_test.rb +++ b/activerecord/test/cases/transaction_isolation_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" unless ActiveRecord::Base.connection.supports_transaction_isolation? diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index ced6045955..79ba306ef5 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/cases/type/adapter_specific_registry_test.rb b/activerecord/test/cases/type/adapter_specific_registry_test.rb index a723a952ea..8b836b4793 100644 --- a/activerecord/test/cases/type/adapter_specific_registry_test.rb +++ b/activerecord/test/cases/type/adapter_specific_registry_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/type/date_time_test.rb b/activerecord/test/cases/type/date_time_test.rb index 9307587564..6848619ece 100644 --- a/activerecord/test/cases/type/date_time_test.rb +++ b/activerecord/test/cases/type/date_time_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/task" diff --git a/activerecord/test/cases/type/integer_test.rb b/activerecord/test/cases/type/integer_test.rb index 13d6d2093b..368b6d7199 100644 --- a/activerecord/test/cases/type/integer_test.rb +++ b/activerecord/test/cases/type/integer_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/company" diff --git a/activerecord/test/cases/type/string_test.rb b/activerecord/test/cases/type/string_test.rb index 899d7ae767..a95da864fa 100644 --- a/activerecord/test/cases/type/string_test.rb +++ b/activerecord/test/cases/type/string_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/type/type_map_test.rb b/activerecord/test/cases/type/type_map_test.rb index f171175b2a..2959d36466 100644 --- a/activerecord/test/cases/type/type_map_test.rb +++ b/activerecord/test/cases/type/type_map_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/type/unsigned_integer_test.rb b/activerecord/test/cases/type/unsigned_integer_test.rb index b0a60a2b3d..1cd4dbc2c5 100644 --- a/activerecord/test/cases/type/unsigned_integer_test.rb +++ b/activerecord/test/cases/type/unsigned_integer_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/type_test.rb b/activerecord/test/cases/type_test.rb index 0f9f698760..d45a9b3141 100644 --- a/activerecord/test/cases/type_test.rb +++ b/activerecord/test/cases/type_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class TypeTest < ActiveRecord::TestCase diff --git a/activerecord/test/cases/types_test.rb b/activerecord/test/cases/types_test.rb index ea55bb00cd..11476ea0ef 100644 --- a/activerecord/test/cases/types_test.rb +++ b/activerecord/test/cases/types_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" module ActiveRecord diff --git a/activerecord/test/cases/unconnected_test.rb b/activerecord/test/cases/unconnected_test.rb index 30efd03955..b210584644 100644 --- a/activerecord/test/cases/unconnected_test.rb +++ b/activerecord/test/cases/unconnected_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" class TestRecord < ActiveRecord::Base diff --git a/activerecord/test/cases/validations/absence_validation_test.rb b/activerecord/test/cases/validations/absence_validation_test.rb index 051f14dbb7..870619e4e7 100644 --- a/activerecord/test/cases/validations/absence_validation_test.rb +++ b/activerecord/test/cases/validations/absence_validation_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/face" require "models/interest" diff --git a/activerecord/test/cases/validations/association_validation_test.rb b/activerecord/test/cases/validations/association_validation_test.rb index 0935dc8c32..f5ceb27d97 100644 --- a/activerecord/test/cases/validations/association_validation_test.rb +++ b/activerecord/test/cases/validations/association_validation_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb b/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb index fdfd568897..a57065ba75 100644 --- a/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb +++ b/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" diff --git a/activerecord/test/cases/validations/i18n_validation_test.rb b/activerecord/test/cases/validations/i18n_validation_test.rb index a020c877e7..fd88a3ea67 100644 --- a/activerecord/test/cases/validations/i18n_validation_test.rb +++ b/activerecord/test/cases/validations/i18n_validation_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/cases/validations/length_validation_test.rb b/activerecord/test/cases/validations/length_validation_test.rb index 7f840dfa7c..ba45c6dcc1 100644 --- a/activerecord/test/cases/validations/length_validation_test.rb +++ b/activerecord/test/cases/validations/length_validation_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/owner" require "models/pet" diff --git a/activerecord/test/cases/validations/presence_validation_test.rb b/activerecord/test/cases/validations/presence_validation_test.rb index dee8528124..13956e26ec 100644 --- a/activerecord/test/cases/validations/presence_validation_test.rb +++ b/activerecord/test/cases/validations/presence_validation_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/man" require "models/face" diff --git a/activerecord/test/cases/validations/uniqueness_validation_test.rb b/activerecord/test/cases/validations/uniqueness_validation_test.rb index e943d03720..28605d2f8e 100644 --- a/activerecord/test/cases/validations/uniqueness_validation_test.rb +++ b/activerecord/test/cases/validations/uniqueness_validation_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/cases/validations_repair_helper.rb b/activerecord/test/cases/validations_repair_helper.rb index 30299fd2c6..b30666d876 100644 --- a/activerecord/test/cases/validations_repair_helper.rb +++ b/activerecord/test/cases/validations_repair_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActiveRecord module ValidationsRepairHelper extend ActiveSupport::Concern diff --git a/activerecord/test/cases/validations_test.rb b/activerecord/test/cases/validations_test.rb index fc9678211a..a305aa295a 100644 --- a/activerecord/test/cases/validations_test.rb +++ b/activerecord/test/cases/validations_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/cases/view_test.rb b/activerecord/test/cases/view_test.rb index 89b72ec336..1d21a2454f 100644 --- a/activerecord/test/cases/view_test.rb +++ b/activerecord/test/cases/view_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/book" require "support/schema_dumping_helper" diff --git a/activerecord/test/cases/yaml_serialization_test.rb b/activerecord/test/cases/yaml_serialization_test.rb index 1b67e150f3..dd8d2c1178 100644 --- a/activerecord/test/cases/yaml_serialization_test.rb +++ b/activerecord/test/cases/yaml_serialization_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cases/helper" require "models/topic" require "models/reply" diff --git a/activerecord/test/config.rb b/activerecord/test/config.rb index d0d1933300..a65e6ff776 100644 --- a/activerecord/test/config.rb +++ b/activerecord/test/config.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true TEST_ROOT = __dir__ ASSETS_ROOT = TEST_ROOT + "/assets" FIXTURES_ROOT = TEST_ROOT + "/fixtures" diff --git a/activerecord/test/migrations/10_urban/9_add_expressions.rb b/activerecord/test/migrations/10_urban/9_add_expressions.rb index db9fda3e05..e908c9eabc 100644 --- a/activerecord/test/migrations/10_urban/9_add_expressions.rb +++ b/activerecord/test/migrations/10_urban/9_add_expressions.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class AddExpressions < ActiveRecord::Migration::Current def self.up create_table("expressions") do |t| diff --git a/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb b/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb index f13f72eb4e..43c79bc20b 100644 --- a/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb +++ b/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class GiveMeBigNumbers < ActiveRecord::Migration::Current def self.up create_table :big_numbers do |table| diff --git a/activerecord/test/migrations/magic/1_currencies_have_symbols.rb b/activerecord/test/migrations/magic/1_currencies_have_symbols.rb index d8a864b213..d4b0e6cd95 100644 --- a/activerecord/test/migrations/magic/1_currencies_have_symbols.rb +++ b/activerecord/test/migrations/magic/1_currencies_have_symbols.rb @@ -1,10 +1,9 @@ -# frozen_string_literal: true # coding: ISO-8859-15 class CurrenciesHaveSymbols < ActiveRecord::Migration::Current def self.up - # We use € for default currency symbol - add_column "currencies", "symbol", :string, default: "€" + # We use € for default currency symbol + add_column "currencies", "symbol", :string, default: "€" end def self.down diff --git a/activerecord/test/migrations/missing/1000_people_have_middle_names.rb b/activerecord/test/migrations/missing/1000_people_have_middle_names.rb index a1a5dcbac2..e046944e31 100644 --- a/activerecord/test/migrations/missing/1000_people_have_middle_names.rb +++ b/activerecord/test/migrations/missing/1000_people_have_middle_names.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class PeopleHaveMiddleNames < ActiveRecord::Migration::Current def self.up add_column "people", "middle_name", :string diff --git a/activerecord/test/migrations/missing/1_people_have_last_names.rb b/activerecord/test/migrations/missing/1_people_have_last_names.rb index 1480b4b8f3..50fe2a9c8e 100644 --- a/activerecord/test/migrations/missing/1_people_have_last_names.rb +++ b/activerecord/test/migrations/missing/1_people_have_last_names.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class PeopleHaveLastNames < ActiveRecord::Migration::Current def self.up add_column "people", "last_name", :string diff --git a/activerecord/test/migrations/missing/3_we_need_reminders.rb b/activerecord/test/migrations/missing/3_we_need_reminders.rb index e69296a31f..d7c63ac892 100644 --- a/activerecord/test/migrations/missing/3_we_need_reminders.rb +++ b/activerecord/test/migrations/missing/3_we_need_reminders.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class WeNeedReminders < ActiveRecord::Migration::Current def self.up create_table("reminders") do |t| diff --git a/activerecord/test/migrations/missing/4_innocent_jointable.rb b/activerecord/test/migrations/missing/4_innocent_jointable.rb index 0c021c6162..bd3bf21576 100644 --- a/activerecord/test/migrations/missing/4_innocent_jointable.rb +++ b/activerecord/test/migrations/missing/4_innocent_jointable.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class InnocentJointable < ActiveRecord::Migration::Current def self.up create_table("people_reminders", id: false) do |t| diff --git a/activerecord/test/migrations/rename/1_we_need_things.rb b/activerecord/test/migrations/rename/1_we_need_things.rb index 411d6f9646..9dce01acfd 100644 --- a/activerecord/test/migrations/rename/1_we_need_things.rb +++ b/activerecord/test/migrations/rename/1_we_need_things.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class WeNeedThings < ActiveRecord::Migration::Current def self.up create_table("things") do |t| diff --git a/activerecord/test/migrations/rename/2_rename_things.rb b/activerecord/test/migrations/rename/2_rename_things.rb index 99b1cec7f5..cb8484e7dc 100644 --- a/activerecord/test/migrations/rename/2_rename_things.rb +++ b/activerecord/test/migrations/rename/2_rename_things.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class RenameThings < ActiveRecord::Migration::Current def self.up rename_table "things", "awesome_things" diff --git a/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb b/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb index 65b92fbb85..76734bcd7d 100644 --- a/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb +++ b/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class PeopleHaveHobbies < ActiveRecord::Migration::Current def self.up add_column "people", "hobbies", :text diff --git a/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb b/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb index 7a3bede29a..7f883dbb45 100644 --- a/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb +++ b/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class PeopleHaveDescriptions < ActiveRecord::Migration::Current def self.up add_column "people", "description", :text diff --git a/activerecord/test/migrations/to_copy2/1_create_articles.rb b/activerecord/test/migrations/to_copy2/1_create_articles.rb index 3a82d15aea..2e9f5ec6bc 100644 --- a/activerecord/test/migrations/to_copy2/1_create_articles.rb +++ b/activerecord/test/migrations/to_copy2/1_create_articles.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class CreateArticles < ActiveRecord::Migration::Current def self.up end diff --git a/activerecord/test/migrations/to_copy2/2_create_comments.rb b/activerecord/test/migrations/to_copy2/2_create_comments.rb index fb1032f8dd..d361847d4b 100644 --- a/activerecord/test/migrations/to_copy2/2_create_comments.rb +++ b/activerecord/test/migrations/to_copy2/2_create_comments.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class CreateComments < ActiveRecord::Migration::Current def self.up end diff --git a/activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb b/activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb index ea106d5be4..1a863367dd 100644 --- a/activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb +++ b/activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class PeopleHaveHobbies < ActiveRecord::Migration::Current def self.up add_column "people", "hobbies", :string diff --git a/activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb b/activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb index 65b92fbb85..76734bcd7d 100644 --- a/activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb +++ b/activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class PeopleHaveHobbies < ActiveRecord::Migration::Current def self.up add_column "people", "hobbies", :text diff --git a/activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb b/activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb index 7a3bede29a..7f883dbb45 100644 --- a/activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb +++ b/activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class PeopleHaveDescriptions < ActiveRecord::Migration::Current def self.up add_column "people", "description", :text diff --git a/activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb b/activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb index 3a82d15aea..2e9f5ec6bc 100644 --- a/activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb +++ b/activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class CreateArticles < ActiveRecord::Migration::Current def self.up end diff --git a/activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb b/activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb index fb1032f8dd..d361847d4b 100644 --- a/activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb +++ b/activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class CreateComments < ActiveRecord::Migration::Current def self.up end diff --git a/activerecord/test/migrations/valid/1_valid_people_have_last_names.rb b/activerecord/test/migrations/valid/1_valid_people_have_last_names.rb index 1d2193469c..c450211d8c 100644 --- a/activerecord/test/migrations/valid/1_valid_people_have_last_names.rb +++ b/activerecord/test/migrations/valid/1_valid_people_have_last_names.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class ValidPeopleHaveLastNames < ActiveRecord::Migration::Current def self.up add_column "people", "last_name", :string diff --git a/activerecord/test/migrations/valid/2_we_need_reminders.rb b/activerecord/test/migrations/valid/2_we_need_reminders.rb index e69296a31f..d7c63ac892 100644 --- a/activerecord/test/migrations/valid/2_we_need_reminders.rb +++ b/activerecord/test/migrations/valid/2_we_need_reminders.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class WeNeedReminders < ActiveRecord::Migration::Current def self.up create_table("reminders") do |t| diff --git a/activerecord/test/migrations/valid/3_innocent_jointable.rb b/activerecord/test/migrations/valid/3_innocent_jointable.rb index 0c021c6162..bd3bf21576 100644 --- a/activerecord/test/migrations/valid/3_innocent_jointable.rb +++ b/activerecord/test/migrations/valid/3_innocent_jointable.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class InnocentJointable < ActiveRecord::Migration::Current def self.up create_table("people_reminders", id: false) do |t| diff --git a/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb b/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb index 1d2193469c..c450211d8c 100644 --- a/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb +++ b/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class ValidPeopleHaveLastNames < ActiveRecord::Migration::Current def self.up add_column "people", "last_name", :string diff --git a/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb b/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb index e69296a31f..d7c63ac892 100644 --- a/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb +++ b/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class WeNeedReminders < ActiveRecord::Migration::Current def self.up create_table("reminders") do |t| diff --git a/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb b/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb index 0c021c6162..bd3bf21576 100644 --- a/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb +++ b/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class InnocentJointable < ActiveRecord::Migration::Current def self.up create_table("people_reminders", id: false) do |t| diff --git a/activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb b/activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb index f7ef1a9769..9fd27593f0 100644 --- a/activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb +++ b/activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class ValidWithTimestampsPeopleHaveLastNames < ActiveRecord::Migration::Current def self.up add_column "people", "last_name", :string diff --git a/activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb b/activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb index 7732032c5d..4a59921136 100644 --- a/activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb +++ b/activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class ValidWithTimestampsWeNeedReminders < ActiveRecord::Migration::Current def self.up create_table("reminders") do |t| diff --git a/activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb b/activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb index cf652c008a..be24de6d70 100644 --- a/activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb +++ b/activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class ValidWithTimestampsInnocentJointable < ActiveRecord::Migration::Current def self.up create_table("people_reminders", id: false) do |t| diff --git a/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb b/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb index ceb0cc98bf..6f314c881c 100644 --- a/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb +++ b/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class MigrationVersionCheck < ActiveRecord::Migration::Current def self.up raise "incorrect migration version" unless version == 20131219224947 diff --git a/activerecord/test/models/admin.rb b/activerecord/test/models/admin.rb index 6c8a6eddb0..bc3ce23447 100644 --- a/activerecord/test/models/admin.rb +++ b/activerecord/test/models/admin.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module Admin def self.table_name_prefix "admin_" diff --git a/activerecord/test/models/admin/account.rb b/activerecord/test/models/admin/account.rb index 2dddfa8fe9..bd23192d20 100644 --- a/activerecord/test/models/admin/account.rb +++ b/activerecord/test/models/admin/account.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Admin::Account < ActiveRecord::Base has_many :users end diff --git a/activerecord/test/models/admin/randomly_named_c1.rb b/activerecord/test/models/admin/randomly_named_c1.rb index dc1c8c66d7..b64ae7fc41 100644 --- a/activerecord/test/models/admin/randomly_named_c1.rb +++ b/activerecord/test/models/admin/randomly_named_c1.rb @@ -1,8 +1,7 @@ -# frozen_string_literal: true -class Admin::ClassNameThatDoesNotFollowCONVENTIONS1 < ActiveRecord::Base - self.table_name = :randomly_named_table2 -end - -class Admin::ClassNameThatDoesNotFollowCONVENTIONS2 < ActiveRecord::Base - self.table_name = :randomly_named_table3 -end +class Admin::ClassNameThatDoesNotFollowCONVENTIONS1 < ActiveRecord::Base + self.table_name = :randomly_named_table2 +end + +class Admin::ClassNameThatDoesNotFollowCONVENTIONS2 < ActiveRecord::Base + self.table_name = :randomly_named_table3 +end diff --git a/activerecord/test/models/admin/user.rb b/activerecord/test/models/admin/user.rb index 1157ca266c..a76e4b6795 100644 --- a/activerecord/test/models/admin/user.rb +++ b/activerecord/test/models/admin/user.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Admin::User < ActiveRecord::Base class Coder def initialize(default = {}) diff --git a/activerecord/test/models/aircraft.rb b/activerecord/test/models/aircraft.rb index 02421afe34..ebd42ff824 100644 --- a/activerecord/test/models/aircraft.rb +++ b/activerecord/test/models/aircraft.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Aircraft < ActiveRecord::Base self.pluralize_table_names = false has_many :engines, foreign_key: "car_id" diff --git a/activerecord/test/models/arunit2_model.rb b/activerecord/test/models/arunit2_model.rb index 80a8ecc5d8..04b8b15d3d 100644 --- a/activerecord/test/models/arunit2_model.rb +++ b/activerecord/test/models/arunit2_model.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class ARUnit2Model < ActiveRecord::Base self.abstract_class = true end diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb index c3278846d6..2d9cba77e0 100644 --- a/activerecord/test/models/author.rb +++ b/activerecord/test/models/author.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Author < ActiveRecord::Base has_many :posts has_many :serialized_posts diff --git a/activerecord/test/models/auto_id.rb b/activerecord/test/models/auto_id.rb index 56479b49eb..82c6544bd5 100644 --- a/activerecord/test/models/auto_id.rb +++ b/activerecord/test/models/auto_id.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class AutoId < ActiveRecord::Base self.table_name = "auto_id_tests" self.primary_key = "auto_id" diff --git a/activerecord/test/models/autoloadable/extra_firm.rb b/activerecord/test/models/autoloadable/extra_firm.rb index 54c421e459..5578ba0d9b 100644 --- a/activerecord/test/models/autoloadable/extra_firm.rb +++ b/activerecord/test/models/autoloadable/extra_firm.rb @@ -1,3 +1,2 @@ -# frozen_string_literal: true class ExtraFirm < Company end diff --git a/activerecord/test/models/binary.rb b/activerecord/test/models/binary.rb index 4b1212705b..39b2f5090a 100644 --- a/activerecord/test/models/binary.rb +++ b/activerecord/test/models/binary.rb @@ -1,3 +1,2 @@ -# frozen_string_literal: true class Binary < ActiveRecord::Base end diff --git a/activerecord/test/models/bird.rb b/activerecord/test/models/bird.rb index ba923b4316..24b839135d 100644 --- a/activerecord/test/models/bird.rb +++ b/activerecord/test/models/bird.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Bird < ActiveRecord::Base belongs_to :pirate validates_presence_of :name diff --git a/activerecord/test/models/book.rb b/activerecord/test/models/book.rb index 46d5d94da3..6466e1b341 100644 --- a/activerecord/test/models/book.rb +++ b/activerecord/test/models/book.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Book < ActiveRecord::Base belongs_to :author diff --git a/activerecord/test/models/boolean.rb b/activerecord/test/models/boolean.rb index e2f1bb8a9a..0da228aac2 100644 --- a/activerecord/test/models/boolean.rb +++ b/activerecord/test/models/boolean.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Boolean < ActiveRecord::Base def has_fun super diff --git a/activerecord/test/models/bulb.rb b/activerecord/test/models/bulb.rb index ad9806db55..113d21cb84 100644 --- a/activerecord/test/models/bulb.rb +++ b/activerecord/test/models/bulb.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Bulb < ActiveRecord::Base default_scope { where(name: "defaulty") } belongs_to :car, touch: true diff --git a/activerecord/test/models/cake_designer.rb b/activerecord/test/models/cake_designer.rb index 20fa26a556..9c57ef573a 100644 --- a/activerecord/test/models/cake_designer.rb +++ b/activerecord/test/models/cake_designer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class CakeDesigner < ActiveRecord::Base has_one :chef, as: :employable end diff --git a/activerecord/test/models/car.rb b/activerecord/test/models/car.rb index 3c3d9295b0..92bff7ff96 100644 --- a/activerecord/test/models/car.rb +++ b/activerecord/test/models/car.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Car < ActiveRecord::Base has_many :bulbs has_many :all_bulbs, -> { unscope where: :name }, class_name: "Bulb" diff --git a/activerecord/test/models/carrier.rb b/activerecord/test/models/carrier.rb index bf8055fbd7..230be118c3 100644 --- a/activerecord/test/models/carrier.rb +++ b/activerecord/test/models/carrier.rb @@ -1,3 +1,2 @@ -# frozen_string_literal: true class Carrier < ActiveRecord::Base end diff --git a/activerecord/test/models/cat.rb b/activerecord/test/models/cat.rb index 4c76ec86cf..dfdde18641 100644 --- a/activerecord/test/models/cat.rb +++ b/activerecord/test/models/cat.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Cat < ActiveRecord::Base self.abstract_class = true diff --git a/activerecord/test/models/categorization.rb b/activerecord/test/models/categorization.rb index 87b81e1e2d..b99383d0b1 100644 --- a/activerecord/test/models/categorization.rb +++ b/activerecord/test/models/categorization.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Categorization < ActiveRecord::Base belongs_to :post belongs_to :category, counter_cache: true diff --git a/activerecord/test/models/category.rb b/activerecord/test/models/category.rb index 392fe94fe7..4b2840c653 100644 --- a/activerecord/test/models/category.rb +++ b/activerecord/test/models/category.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Category < ActiveRecord::Base has_and_belongs_to_many :posts has_and_belongs_to_many :special_posts, class_name: "Post" diff --git a/activerecord/test/models/chef.rb b/activerecord/test/models/chef.rb index daa208ff5f..9d3dd01016 100644 --- a/activerecord/test/models/chef.rb +++ b/activerecord/test/models/chef.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Chef < ActiveRecord::Base belongs_to :employable, polymorphic: true has_many :recipes diff --git a/activerecord/test/models/citation.rb b/activerecord/test/models/citation.rb index 8a6c300a28..7d06387f56 100644 --- a/activerecord/test/models/citation.rb +++ b/activerecord/test/models/citation.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Citation < ActiveRecord::Base belongs_to :reference_of, class_name: "Book", foreign_key: :book2_id end diff --git a/activerecord/test/models/club.rb b/activerecord/test/models/club.rb index cdd5b37792..49d7b24a3b 100644 --- a/activerecord/test/models/club.rb +++ b/activerecord/test/models/club.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Club < ActiveRecord::Base has_one :membership has_many :memberships, inverse_of: false diff --git a/activerecord/test/models/college.rb b/activerecord/test/models/college.rb index 70c0cd1534..c9dbe1ecc2 100644 --- a/activerecord/test/models/college.rb +++ b/activerecord/test/models/college.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require_dependency "models/arunit2_model" require "active_support/core_ext/object/with_options" diff --git a/activerecord/test/models/column.rb b/activerecord/test/models/column.rb index 08e1a4ae2d..499358b4cf 100644 --- a/activerecord/test/models/column.rb +++ b/activerecord/test/models/column.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Column < ActiveRecord::Base belongs_to :record end diff --git a/activerecord/test/models/column_name.rb b/activerecord/test/models/column_name.rb index 3b4452c3c2..460eb4fe20 100644 --- a/activerecord/test/models/column_name.rb +++ b/activerecord/test/models/column_name.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class ColumnName < ActiveRecord::Base self.table_name = "colnametests" end diff --git a/activerecord/test/models/comment.rb b/activerecord/test/models/comment.rb index 6c10ec0858..eecf923046 100644 --- a/activerecord/test/models/comment.rb +++ b/activerecord/test/models/comment.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Comment < ActiveRecord::Base scope :limit_by, lambda { |l| limit(l) } scope :containing_the_letter_e, -> { where("comments.body LIKE '%e%'") } diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index 8a6d909188..c6a5bf1c92 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class AbstractCompany < ActiveRecord::Base self.abstract_class = true end diff --git a/activerecord/test/models/company_in_module.rb b/activerecord/test/models/company_in_module.rb index 2e7295eed1..0782c1eff4 100644 --- a/activerecord/test/models/company_in_module.rb +++ b/activerecord/test/models/company_in_module.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/object/with_options" module MyApplication diff --git a/activerecord/test/models/computer.rb b/activerecord/test/models/computer.rb index f2998d362a..1c9856e1af 100644 --- a/activerecord/test/models/computer.rb +++ b/activerecord/test/models/computer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Computer < ActiveRecord::Base belongs_to :developer, foreign_key: "developer" end diff --git a/activerecord/test/models/contact.rb b/activerecord/test/models/contact.rb index 0a095301bd..47bbbbfd8b 100644 --- a/activerecord/test/models/contact.rb +++ b/activerecord/test/models/contact.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ContactFakeColumns def self.extended(base) base.class_eval do diff --git a/activerecord/test/models/content.rb b/activerecord/test/models/content.rb index f2913be22d..68db2127d8 100644 --- a/activerecord/test/models/content.rb +++ b/activerecord/test/models/content.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Content < ActiveRecord::Base self.table_name = "content" has_one :content_position, dependent: :destroy diff --git a/activerecord/test/models/contract.rb b/activerecord/test/models/contract.rb index e4bace0e32..32bd581377 100644 --- a/activerecord/test/models/contract.rb +++ b/activerecord/test/models/contract.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Contract < ActiveRecord::Base belongs_to :company belongs_to :developer diff --git a/activerecord/test/models/country.rb b/activerecord/test/models/country.rb index 5c1c6dc492..7912719ddd 100644 --- a/activerecord/test/models/country.rb +++ b/activerecord/test/models/country.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Country < ActiveRecord::Base self.primary_key = :country_id diff --git a/activerecord/test/models/course.rb b/activerecord/test/models/course.rb index 0af33ed85f..348f2bf1e0 100644 --- a/activerecord/test/models/course.rb +++ b/activerecord/test/models/course.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require_dependency "models/arunit2_model" class Course < ARUnit2Model diff --git a/activerecord/test/models/customer.rb b/activerecord/test/models/customer.rb index 2eb4c720a6..3d40cb1ace 100644 --- a/activerecord/test/models/customer.rb +++ b/activerecord/test/models/customer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Customer < ActiveRecord::Base cattr_accessor :gps_conversion_was_run diff --git a/activerecord/test/models/customer_carrier.rb b/activerecord/test/models/customer_carrier.rb index 3d236da43d..37186903ff 100644 --- a/activerecord/test/models/customer_carrier.rb +++ b/activerecord/test/models/customer_carrier.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class CustomerCarrier < ActiveRecord::Base cattr_accessor :current_customer diff --git a/activerecord/test/models/dashboard.rb b/activerecord/test/models/dashboard.rb index fe54e9d6fc..1b3b54545f 100644 --- a/activerecord/test/models/dashboard.rb +++ b/activerecord/test/models/dashboard.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Dashboard < ActiveRecord::Base self.primary_key = :dashboard_id end diff --git a/activerecord/test/models/default.rb b/activerecord/test/models/default.rb index 6f87ee74f7..887e9cc999 100644 --- a/activerecord/test/models/default.rb +++ b/activerecord/test/models/default.rb @@ -1,3 +1,2 @@ -# frozen_string_literal: true class Default < ActiveRecord::Base end diff --git a/activerecord/test/models/department.rb b/activerecord/test/models/department.rb index e8cdae8976..08004a0ed3 100644 --- a/activerecord/test/models/department.rb +++ b/activerecord/test/models/department.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Department < ActiveRecord::Base has_many :chefs belongs_to :hotel diff --git a/activerecord/test/models/developer.rb b/activerecord/test/models/developer.rb index aa7798c582..654830ba11 100644 --- a/activerecord/test/models/developer.rb +++ b/activerecord/test/models/developer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "ostruct" module DeveloperProjectsAssociationExtension2 diff --git a/activerecord/test/models/dog.rb b/activerecord/test/models/dog.rb index 08eeb6b75e..b02b8447b8 100644 --- a/activerecord/test/models/dog.rb +++ b/activerecord/test/models/dog.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Dog < ActiveRecord::Base belongs_to :breeder, class_name: "DogLover", counter_cache: :bred_dogs_count belongs_to :trainer, class_name: "DogLover", counter_cache: :trained_dogs_count diff --git a/activerecord/test/models/dog_lover.rb b/activerecord/test/models/dog_lover.rb index 75e43bda8a..2c5be94aea 100644 --- a/activerecord/test/models/dog_lover.rb +++ b/activerecord/test/models/dog_lover.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class DogLover < ActiveRecord::Base has_many :trained_dogs, class_name: "Dog", foreign_key: :trainer_id, dependent: :destroy has_many :bred_dogs, class_name: "Dog", foreign_key: :breeder_id diff --git a/activerecord/test/models/doubloon.rb b/activerecord/test/models/doubloon.rb index e18868e022..7272504666 100644 --- a/activerecord/test/models/doubloon.rb +++ b/activerecord/test/models/doubloon.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class AbstractDoubloon < ActiveRecord::Base # This has functionality that might be shared by multiple classes. diff --git a/activerecord/test/models/drink_designer.rb b/activerecord/test/models/drink_designer.rb index 9de6e3d618..2db968ef11 100644 --- a/activerecord/test/models/drink_designer.rb +++ b/activerecord/test/models/drink_designer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class DrinkDesigner < ActiveRecord::Base has_one :chef, as: :employable end diff --git a/activerecord/test/models/edge.rb b/activerecord/test/models/edge.rb index 9711ea6da9..e61d25c9bc 100644 --- a/activerecord/test/models/edge.rb +++ b/activerecord/test/models/edge.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true # This class models an edge in a directed graph. class Edge < ActiveRecord::Base belongs_to :source, class_name: "Vertex", foreign_key: "source_id" diff --git a/activerecord/test/models/electron.rb b/activerecord/test/models/electron.rb index 1828d173bb..6fc270673f 100644 --- a/activerecord/test/models/electron.rb +++ b/activerecord/test/models/electron.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Electron < ActiveRecord::Base belongs_to :molecule diff --git a/activerecord/test/models/engine.rb b/activerecord/test/models/engine.rb index 144bf7159b..eada171f6a 100644 --- a/activerecord/test/models/engine.rb +++ b/activerecord/test/models/engine.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Engine < ActiveRecord::Base belongs_to :my_car, class_name: "Car", foreign_key: "car_id", counter_cache: :engines_count end diff --git a/activerecord/test/models/entrant.rb b/activerecord/test/models/entrant.rb index 77095e28c5..4682ce48c8 100644 --- a/activerecord/test/models/entrant.rb +++ b/activerecord/test/models/entrant.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Entrant < ActiveRecord::Base belongs_to :course end diff --git a/activerecord/test/models/essay.rb b/activerecord/test/models/essay.rb index 302a862907..1f9772870e 100644 --- a/activerecord/test/models/essay.rb +++ b/activerecord/test/models/essay.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Essay < ActiveRecord::Base belongs_to :author belongs_to :writer, primary_key: :name, polymorphic: true diff --git a/activerecord/test/models/event.rb b/activerecord/test/models/event.rb index ac9bc63f34..365ab32b0b 100644 --- a/activerecord/test/models/event.rb +++ b/activerecord/test/models/event.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Event < ActiveRecord::Base validates_uniqueness_of :title end diff --git a/activerecord/test/models/eye.rb b/activerecord/test/models/eye.rb index a7410e8aa9..f53c34e4b1 100644 --- a/activerecord/test/models/eye.rb +++ b/activerecord/test/models/eye.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Eye < ActiveRecord::Base attr_reader :after_create_callbacks_stack attr_reader :after_update_callbacks_stack diff --git a/activerecord/test/models/face.rb b/activerecord/test/models/face.rb index 3c78bf9284..5913bfa969 100644 --- a/activerecord/test/models/face.rb +++ b/activerecord/test/models/face.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Face < ActiveRecord::Base belongs_to :man, inverse_of: :face belongs_to :polymorphic_man, polymorphic: true, inverse_of: :polymorphic_face diff --git a/activerecord/test/models/family.rb b/activerecord/test/models/family.rb index 24bc3cc457..5ae5a78c95 100644 --- a/activerecord/test/models/family.rb +++ b/activerecord/test/models/family.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Family < ActiveRecord::Base has_many :family_trees, -> { where(token: nil) } has_many :members, through: :family_trees diff --git a/activerecord/test/models/family_tree.rb b/activerecord/test/models/family_tree.rb index 94a905246a..cd9829fedd 100644 --- a/activerecord/test/models/family_tree.rb +++ b/activerecord/test/models/family_tree.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class FamilyTree < ActiveRecord::Base belongs_to :member, class_name: "User", foreign_key: "member_id" belongs_to :family diff --git a/activerecord/test/models/friendship.rb b/activerecord/test/models/friendship.rb index e9ecfe7e25..578382b494 100644 --- a/activerecord/test/models/friendship.rb +++ b/activerecord/test/models/friendship.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Friendship < ActiveRecord::Base belongs_to :friend, class_name: "Person" # friend_too exists to test a bug, and probably shouldn't be used elsewhere diff --git a/activerecord/test/models/guid.rb b/activerecord/test/models/guid.rb index 8653b617b1..05653ba498 100644 --- a/activerecord/test/models/guid.rb +++ b/activerecord/test/models/guid.rb @@ -1,3 +1,2 @@ -# frozen_string_literal: true class Guid < ActiveRecord::Base end diff --git a/activerecord/test/models/guitar.rb b/activerecord/test/models/guitar.rb index a1a3226272..cd068ff53d 100644 --- a/activerecord/test/models/guitar.rb +++ b/activerecord/test/models/guitar.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Guitar < ActiveRecord::Base has_many :tuning_pegs, index_errors: true accepts_nested_attributes_for :tuning_pegs diff --git a/activerecord/test/models/hotel.rb b/activerecord/test/models/hotel.rb index 1d20d17e3b..7bc717c891 100644 --- a/activerecord/test/models/hotel.rb +++ b/activerecord/test/models/hotel.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Hotel < ActiveRecord::Base has_many :departments has_many :chefs, through: :departments diff --git a/activerecord/test/models/image.rb b/activerecord/test/models/image.rb index 1efe679022..7ae8e4a7f6 100644 --- a/activerecord/test/models/image.rb +++ b/activerecord/test/models/image.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Image < ActiveRecord::Base belongs_to :imageable, foreign_key: :imageable_identifier, foreign_type: :imageable_class end diff --git a/activerecord/test/models/interest.rb b/activerecord/test/models/interest.rb index 10e855be4d..ec79416ee7 100644 --- a/activerecord/test/models/interest.rb +++ b/activerecord/test/models/interest.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Interest < ActiveRecord::Base belongs_to :man, inverse_of: :interests belongs_to :polymorphic_man, polymorphic: true, inverse_of: :polymorphic_interests diff --git a/activerecord/test/models/invoice.rb b/activerecord/test/models/invoice.rb index df37e2a9e1..4be5a00193 100644 --- a/activerecord/test/models/invoice.rb +++ b/activerecord/test/models/invoice.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Invoice < ActiveRecord::Base has_many :line_items, autosave: true before_save { |record| record.balance = record.line_items.map(&:amount).sum } diff --git a/activerecord/test/models/item.rb b/activerecord/test/models/item.rb index 86a1fc625e..336fb1769a 100644 --- a/activerecord/test/models/item.rb +++ b/activerecord/test/models/item.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class AbstractItem < ActiveRecord::Base self.abstract_class = true has_one :tagging, as: :taggable diff --git a/activerecord/test/models/job.rb b/activerecord/test/models/job.rb index 6c4dff4bcd..bbaef2792c 100644 --- a/activerecord/test/models/job.rb +++ b/activerecord/test/models/job.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Job < ActiveRecord::Base has_many :references has_many :people, through: :references diff --git a/activerecord/test/models/joke.rb b/activerecord/test/models/joke.rb index 5c2443036a..eeb5818a1f 100644 --- a/activerecord/test/models/joke.rb +++ b/activerecord/test/models/joke.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Joke < ActiveRecord::Base self.table_name = "funny_jokes" end diff --git a/activerecord/test/models/keyboard.rb b/activerecord/test/models/keyboard.rb index d179de8e1c..bcede53ec9 100644 --- a/activerecord/test/models/keyboard.rb +++ b/activerecord/test/models/keyboard.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Keyboard < ActiveRecord::Base self.primary_key = "key_number" end diff --git a/activerecord/test/models/legacy_thing.rb b/activerecord/test/models/legacy_thing.rb index 948d575bb8..eead181a0e 100644 --- a/activerecord/test/models/legacy_thing.rb +++ b/activerecord/test/models/legacy_thing.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class LegacyThing < ActiveRecord::Base self.locking_column = :version end diff --git a/activerecord/test/models/lesson.rb b/activerecord/test/models/lesson.rb index 086ff55b42..4c88153068 100644 --- a/activerecord/test/models/lesson.rb +++ b/activerecord/test/models/lesson.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class LessonError < Exception end diff --git a/activerecord/test/models/line_item.rb b/activerecord/test/models/line_item.rb index 1ef2eda97a..93f7cceb13 100644 --- a/activerecord/test/models/line_item.rb +++ b/activerecord/test/models/line_item.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class LineItem < ActiveRecord::Base belongs_to :invoice, touch: true end diff --git a/activerecord/test/models/liquid.rb b/activerecord/test/models/liquid.rb index 9440292c78..69d4d7df1a 100644 --- a/activerecord/test/models/liquid.rb +++ b/activerecord/test/models/liquid.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Liquid < ActiveRecord::Base self.table_name = :liquid has_many :molecules, -> { distinct } diff --git a/activerecord/test/models/man.rb b/activerecord/test/models/man.rb index bf81aa9fc6..d2436a735c 100644 --- a/activerecord/test/models/man.rb +++ b/activerecord/test/models/man.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Man < ActiveRecord::Base has_one :face, inverse_of: :man has_one :polymorphic_face, class_name: "Face", as: :polymorphic_man, inverse_of: :polymorphic_man diff --git a/activerecord/test/models/matey.rb b/activerecord/test/models/matey.rb index 00311f78fe..80ee5f47c5 100644 --- a/activerecord/test/models/matey.rb +++ b/activerecord/test/models/matey.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Matey < ActiveRecord::Base belongs_to :pirate belongs_to :target, class_name: "Pirate" diff --git a/activerecord/test/models/member.rb b/activerecord/test/models/member.rb index 99a037e0f6..36f2461b84 100644 --- a/activerecord/test/models/member.rb +++ b/activerecord/test/models/member.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Member < ActiveRecord::Base has_one :current_membership has_one :selected_membership diff --git a/activerecord/test/models/member_detail.rb b/activerecord/test/models/member_detail.rb index 8311d202da..157130986c 100644 --- a/activerecord/test/models/member_detail.rb +++ b/activerecord/test/models/member_detail.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class MemberDetail < ActiveRecord::Base belongs_to :member, inverse_of: false belongs_to :organization diff --git a/activerecord/test/models/member_type.rb b/activerecord/test/models/member_type.rb index 3c159a885a..a13561c72a 100644 --- a/activerecord/test/models/member_type.rb +++ b/activerecord/test/models/member_type.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class MemberType < ActiveRecord::Base has_many :members end diff --git a/activerecord/test/models/membership.rb b/activerecord/test/models/membership.rb index bd957f1de8..0f8be0ad85 100644 --- a/activerecord/test/models/membership.rb +++ b/activerecord/test/models/membership.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Membership < ActiveRecord::Base enum type: %i(Membership CurrentMembership SuperMembership SelectedMembership TenantMembership) belongs_to :member diff --git a/activerecord/test/models/mentor.rb b/activerecord/test/models/mentor.rb index 9e52d39e46..66504b4e91 100644 --- a/activerecord/test/models/mentor.rb +++ b/activerecord/test/models/mentor.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Mentor < ActiveRecord::Base has_many :developers end diff --git a/activerecord/test/models/minimalistic.rb b/activerecord/test/models/minimalistic.rb index c31eea65c9..2e3f8e081a 100644 --- a/activerecord/test/models/minimalistic.rb +++ b/activerecord/test/models/minimalistic.rb @@ -1,3 +1,2 @@ -# frozen_string_literal: true class Minimalistic < ActiveRecord::Base end diff --git a/activerecord/test/models/minivan.rb b/activerecord/test/models/minivan.rb index 4d04d808a9..e9b05dadf2 100644 --- a/activerecord/test/models/minivan.rb +++ b/activerecord/test/models/minivan.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Minivan < ActiveRecord::Base self.primary_key = :minivan_id diff --git a/activerecord/test/models/mixed_case_monkey.rb b/activerecord/test/models/mixed_case_monkey.rb index 552de2c18c..1c35006665 100644 --- a/activerecord/test/models/mixed_case_monkey.rb +++ b/activerecord/test/models/mixed_case_monkey.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class MixedCaseMonkey < ActiveRecord::Base belongs_to :man end diff --git a/activerecord/test/models/mocktail_designer.rb b/activerecord/test/models/mocktail_designer.rb index fc9fc4c942..77b44651a3 100644 --- a/activerecord/test/models/mocktail_designer.rb +++ b/activerecord/test/models/mocktail_designer.rb @@ -1,3 +1,2 @@ -# frozen_string_literal: true class MocktailDesigner < DrinkDesigner end diff --git a/activerecord/test/models/molecule.rb b/activerecord/test/models/molecule.rb index 8e0f6eb6ee..26870c8f88 100644 --- a/activerecord/test/models/molecule.rb +++ b/activerecord/test/models/molecule.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Molecule < ActiveRecord::Base belongs_to :liquid has_many :electrons diff --git a/activerecord/test/models/movie.rb b/activerecord/test/models/movie.rb index fc620656e4..0302abad1e 100644 --- a/activerecord/test/models/movie.rb +++ b/activerecord/test/models/movie.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Movie < ActiveRecord::Base self.primary_key = "movieid" diff --git a/activerecord/test/models/node.rb b/activerecord/test/models/node.rb index 3422a9ea3a..459ea8cf95 100644 --- a/activerecord/test/models/node.rb +++ b/activerecord/test/models/node.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Node < ActiveRecord::Base belongs_to :tree, touch: true belongs_to :parent, class_name: "Node", touch: true, optional: true diff --git a/activerecord/test/models/non_primary_key.rb b/activerecord/test/models/non_primary_key.rb index 4a5fdb88b8..1cafb09608 100644 --- a/activerecord/test/models/non_primary_key.rb +++ b/activerecord/test/models/non_primary_key.rb @@ -1,3 +1,2 @@ -# frozen_string_literal: true class NonPrimaryKey < ActiveRecord::Base end diff --git a/activerecord/test/models/notification.rb b/activerecord/test/models/notification.rb index 9e8ce108d5..82edc64b68 100644 --- a/activerecord/test/models/notification.rb +++ b/activerecord/test/models/notification.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Notification < ActiveRecord::Base validates_presence_of :message end diff --git a/activerecord/test/models/numeric_data.rb b/activerecord/test/models/numeric_data.rb index 8998495101..c6e025a9ce 100644 --- a/activerecord/test/models/numeric_data.rb +++ b/activerecord/test/models/numeric_data.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class NumericData < ActiveRecord::Base self.table_name = "numeric_data" # Decimal columns with 0 scale being automatically treated as integers diff --git a/activerecord/test/models/order.rb b/activerecord/test/models/order.rb index c8693586a0..699be53959 100644 --- a/activerecord/test/models/order.rb +++ b/activerecord/test/models/order.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Order < ActiveRecord::Base belongs_to :billing, class_name: "Customer", foreign_key: "billing_customer_id" belongs_to :shipping, class_name: "Customer", foreign_key: "shipping_customer_id" diff --git a/activerecord/test/models/organization.rb b/activerecord/test/models/organization.rb index c08a01994b..462830dadc 100644 --- a/activerecord/test/models/organization.rb +++ b/activerecord/test/models/organization.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Organization < ActiveRecord::Base has_many :member_details has_many :members, through: :member_details diff --git a/activerecord/test/models/other_dog.rb b/activerecord/test/models/other_dog.rb index a836d9de1a..418caf34be 100644 --- a/activerecord/test/models/other_dog.rb +++ b/activerecord/test/models/other_dog.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require_dependency "models/arunit2_model" class OtherDog < ARUnit2Model diff --git a/activerecord/test/models/owner.rb b/activerecord/test/models/owner.rb index f6190fe5af..21fc9b6eb8 100644 --- a/activerecord/test/models/owner.rb +++ b/activerecord/test/models/owner.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Owner < ActiveRecord::Base self.primary_key = :owner_id has_many :pets, -> { order "pets.name desc" } diff --git a/activerecord/test/models/parrot.rb b/activerecord/test/models/parrot.rb index 4a027fa0bb..1e5f9285a8 100644 --- a/activerecord/test/models/parrot.rb +++ b/activerecord/test/models/parrot.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Parrot < ActiveRecord::Base self.inheritance_column = :parrot_sti_class diff --git a/activerecord/test/models/person.rb b/activerecord/test/models/person.rb index c1ea965a6e..18994d6f18 100644 --- a/activerecord/test/models/person.rb +++ b/activerecord/test/models/person.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Person < ActiveRecord::Base has_many :readers has_many :secure_readers diff --git a/activerecord/test/models/personal_legacy_thing.rb b/activerecord/test/models/personal_legacy_thing.rb index 1a70aa7e7b..adde7a504a 100644 --- a/activerecord/test/models/personal_legacy_thing.rb +++ b/activerecord/test/models/personal_legacy_thing.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class PersonalLegacyThing < ActiveRecord::Base self.locking_column = :version belongs_to :person, counter_cache: true diff --git a/activerecord/test/models/pet.rb b/activerecord/test/models/pet.rb index f0d82ddfc9..51a3e42815 100644 --- a/activerecord/test/models/pet.rb +++ b/activerecord/test/models/pet.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Pet < ActiveRecord::Base attr_accessor :current_user diff --git a/activerecord/test/models/pet_treasure.rb b/activerecord/test/models/pet_treasure.rb index 2d552bf50c..1fe7807ffe 100644 --- a/activerecord/test/models/pet_treasure.rb +++ b/activerecord/test/models/pet_treasure.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class PetTreasure < ActiveRecord::Base self.table_name = "pets_treasures" diff --git a/activerecord/test/models/pirate.rb b/activerecord/test/models/pirate.rb index 21fe1b7847..c532ab426e 100644 --- a/activerecord/test/models/pirate.rb +++ b/activerecord/test/models/pirate.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Pirate < ActiveRecord::Base belongs_to :parrot, validate: true belongs_to :non_validated_parrot, class_name: "Parrot" diff --git a/activerecord/test/models/possession.rb b/activerecord/test/models/possession.rb index d8c2a5f21f..0226336c16 100644 --- a/activerecord/test/models/possession.rb +++ b/activerecord/test/models/possession.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Possession < ActiveRecord::Base self.table_name = "having" end diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb index 534ba47c98..ed64e0ee52 100644 --- a/activerecord/test/models/post.rb +++ b/activerecord/test/models/post.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Post < ActiveRecord::Base class CategoryPost < ActiveRecord::Base self.table_name = "categories_posts" diff --git a/activerecord/test/models/price_estimate.rb b/activerecord/test/models/price_estimate.rb index abdff640c7..ce086e40a3 100644 --- a/activerecord/test/models/price_estimate.rb +++ b/activerecord/test/models/price_estimate.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class PriceEstimate < ActiveRecord::Base belongs_to :estimate_of, polymorphic: true belongs_to :thing, polymorphic: true diff --git a/activerecord/test/models/professor.rb b/activerecord/test/models/professor.rb index 6ec183bb07..4dfb1a9602 100644 --- a/activerecord/test/models/professor.rb +++ b/activerecord/test/models/professor.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require_dependency "models/arunit2_model" class Professor < ARUnit2Model diff --git a/activerecord/test/models/project.rb b/activerecord/test/models/project.rb index e30f1d729a..4fbd986e40 100644 --- a/activerecord/test/models/project.rb +++ b/activerecord/test/models/project.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Project < ActiveRecord::Base belongs_to :mentor has_and_belongs_to_many :developers, -> { distinct.order "developers.name desc, developers.id desc" } diff --git a/activerecord/test/models/publisher.rb b/activerecord/test/models/publisher.rb index 55cf0e42a5..0d4a7f9235 100644 --- a/activerecord/test/models/publisher.rb +++ b/activerecord/test/models/publisher.rb @@ -1,3 +1,2 @@ -# frozen_string_literal: true module Publisher end diff --git a/activerecord/test/models/publisher/article.rb b/activerecord/test/models/publisher/article.rb index 43b88117e0..d73a8eb936 100644 --- a/activerecord/test/models/publisher/article.rb +++ b/activerecord/test/models/publisher/article.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Publisher::Article < ActiveRecord::Base has_and_belongs_to_many :magazines has_and_belongs_to_many :tags diff --git a/activerecord/test/models/publisher/magazine.rb b/activerecord/test/models/publisher/magazine.rb index 25e34aca99..82e1a14008 100644 --- a/activerecord/test/models/publisher/magazine.rb +++ b/activerecord/test/models/publisher/magazine.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Publisher::Magazine < ActiveRecord::Base has_and_belongs_to_many :articles end diff --git a/activerecord/test/models/randomly_named_c1.rb b/activerecord/test/models/randomly_named_c1.rb index 1cd2ca1bb8..d4be1e13b4 100644 --- a/activerecord/test/models/randomly_named_c1.rb +++ b/activerecord/test/models/randomly_named_c1.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true -class ClassNameThatDoesNotFollowCONVENTIONS < ActiveRecord::Base - self.table_name = :randomly_named_table1 -end +class ClassNameThatDoesNotFollowCONVENTIONS < ActiveRecord::Base + self.table_name = :randomly_named_table1 +end diff --git a/activerecord/test/models/rating.rb b/activerecord/test/models/rating.rb index 753df20e8d..7420821db0 100644 --- a/activerecord/test/models/rating.rb +++ b/activerecord/test/models/rating.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Rating < ActiveRecord::Base belongs_to :comment has_many :taggings, as: :taggable diff --git a/activerecord/test/models/reader.rb b/activerecord/test/models/reader.rb index 05a17eca8b..7c5a159fe0 100644 --- a/activerecord/test/models/reader.rb +++ b/activerecord/test/models/reader.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Reader < ActiveRecord::Base belongs_to :post belongs_to :person, inverse_of: :readers diff --git a/activerecord/test/models/recipe.rb b/activerecord/test/models/recipe.rb index 8f81807340..c387230603 100644 --- a/activerecord/test/models/recipe.rb +++ b/activerecord/test/models/recipe.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Recipe < ActiveRecord::Base belongs_to :chef end diff --git a/activerecord/test/models/record.rb b/activerecord/test/models/record.rb index 81d5baa6b1..f77ac9fc03 100644 --- a/activerecord/test/models/record.rb +++ b/activerecord/test/models/record.rb @@ -1,3 +1,2 @@ -# frozen_string_literal: true class Record < ActiveRecord::Base end diff --git a/activerecord/test/models/reference.rb b/activerecord/test/models/reference.rb index 5daa48d8ce..e2bb980fed 100644 --- a/activerecord/test/models/reference.rb +++ b/activerecord/test/models/reference.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Reference < ActiveRecord::Base belongs_to :person belongs_to :job diff --git a/activerecord/test/models/reply.rb b/activerecord/test/models/reply.rb index f3372e81fd..a2d169292a 100644 --- a/activerecord/test/models/reply.rb +++ b/activerecord/test/models/reply.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "models/topic" class Reply < Topic diff --git a/activerecord/test/models/ship.rb b/activerecord/test/models/ship.rb index 0ee8da78db..77a7b22315 100644 --- a/activerecord/test/models/ship.rb +++ b/activerecord/test/models/ship.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Ship < ActiveRecord::Base self.record_timestamps = false diff --git a/activerecord/test/models/ship_part.rb b/activerecord/test/models/ship_part.rb index 67c089a7d0..1a633b8d77 100644 --- a/activerecord/test/models/ship_part.rb +++ b/activerecord/test/models/ship_part.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class ShipPart < ActiveRecord::Base belongs_to :ship has_many :trinkets, class_name: "Treasure", as: :looter diff --git a/activerecord/test/models/shop.rb b/activerecord/test/models/shop.rb index 819af853ad..f9d23d13b0 100644 --- a/activerecord/test/models/shop.rb +++ b/activerecord/test/models/shop.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module Shop class Collection < ActiveRecord::Base has_many :products, dependent: :nullify diff --git a/activerecord/test/models/shop_account.rb b/activerecord/test/models/shop_account.rb index cb00e202f0..1580e8b20c 100644 --- a/activerecord/test/models/shop_account.rb +++ b/activerecord/test/models/shop_account.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class ShopAccount < ActiveRecord::Base belongs_to :customer belongs_to :customer_carrier diff --git a/activerecord/test/models/speedometer.rb b/activerecord/test/models/speedometer.rb index b34e3c16fc..497c3aba9a 100644 --- a/activerecord/test/models/speedometer.rb +++ b/activerecord/test/models/speedometer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Speedometer < ActiveRecord::Base self.primary_key = :speedometer_id belongs_to :dashboard diff --git a/activerecord/test/models/sponsor.rb b/activerecord/test/models/sponsor.rb index cfcd1f762a..3f142b25fe 100644 --- a/activerecord/test/models/sponsor.rb +++ b/activerecord/test/models/sponsor.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Sponsor < ActiveRecord::Base belongs_to :sponsor_club, class_name: "Club", foreign_key: "club_id" belongs_to :sponsorable, polymorphic: true diff --git a/activerecord/test/models/string_key_object.rb b/activerecord/test/models/string_key_object.rb index 94c7fb7582..f084ec1bdc 100644 --- a/activerecord/test/models/string_key_object.rb +++ b/activerecord/test/models/string_key_object.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class StringKeyObject < ActiveRecord::Base self.primary_key = :id end diff --git a/activerecord/test/models/student.rb b/activerecord/test/models/student.rb index 888a0ae481..28a0b6c99b 100644 --- a/activerecord/test/models/student.rb +++ b/activerecord/test/models/student.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Student < ActiveRecord::Base has_and_belongs_to_many :lessons belongs_to :college diff --git a/activerecord/test/models/subscriber.rb b/activerecord/test/models/subscriber.rb index 8ef679486d..a820329003 100644 --- a/activerecord/test/models/subscriber.rb +++ b/activerecord/test/models/subscriber.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Subscriber < ActiveRecord::Base self.primary_key = "nick" has_many :subscriptions diff --git a/activerecord/test/models/subscription.rb b/activerecord/test/models/subscription.rb index e210836413..1cedf6deae 100644 --- a/activerecord/test/models/subscription.rb +++ b/activerecord/test/models/subscription.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Subscription < ActiveRecord::Base belongs_to :subscriber, counter_cache: :books_count belongs_to :book diff --git a/activerecord/test/models/tag.rb b/activerecord/test/models/tag.rb index 6c59dc6183..c907aea10f 100644 --- a/activerecord/test/models/tag.rb +++ b/activerecord/test/models/tag.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Tag < ActiveRecord::Base has_many :taggings has_many :taggables, through: :taggings diff --git a/activerecord/test/models/tagging.rb b/activerecord/test/models/tagging.rb index 0060b96f73..f739b4a197 100644 --- a/activerecord/test/models/tagging.rb +++ b/activerecord/test/models/tagging.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true # test that attr_readonly isn't called on the :taggable polymorphic association module Taggable end diff --git a/activerecord/test/models/task.rb b/activerecord/test/models/task.rb index 1ab1048bdb..e36989dd56 100644 --- a/activerecord/test/models/task.rb +++ b/activerecord/test/models/task.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Task < ActiveRecord::Base def updated_at ending diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb index a74263428b..d9381ac9cf 100644 --- a/activerecord/test/models/topic.rb +++ b/activerecord/test/models/topic.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Topic < ActiveRecord::Base scope :base, -> { all } scope :written_before, lambda { |time| diff --git a/activerecord/test/models/toy.rb b/activerecord/test/models/toy.rb index 97b877caea..ddc7048a56 100644 --- a/activerecord/test/models/toy.rb +++ b/activerecord/test/models/toy.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Toy < ActiveRecord::Base self.primary_key = :toy_id belongs_to :pet diff --git a/activerecord/test/models/traffic_light.rb b/activerecord/test/models/traffic_light.rb index 595b1cb716..a6b7edb882 100644 --- a/activerecord/test/models/traffic_light.rb +++ b/activerecord/test/models/traffic_light.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class TrafficLight < ActiveRecord::Base serialize :state, Array serialize :long_state, Array diff --git a/activerecord/test/models/treasure.rb b/activerecord/test/models/treasure.rb index 3f2162a63d..fb2a5d44e2 100644 --- a/activerecord/test/models/treasure.rb +++ b/activerecord/test/models/treasure.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Treasure < ActiveRecord::Base has_and_belongs_to_many :parrots belongs_to :looter, polymorphic: true diff --git a/activerecord/test/models/treaty.rb b/activerecord/test/models/treaty.rb index a6c227c84e..373cd48f71 100644 --- a/activerecord/test/models/treaty.rb +++ b/activerecord/test/models/treaty.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Treaty < ActiveRecord::Base self.primary_key = :treaty_id diff --git a/activerecord/test/models/tree.rb b/activerecord/test/models/tree.rb index 844c2693ec..dc29cccc9c 100644 --- a/activerecord/test/models/tree.rb +++ b/activerecord/test/models/tree.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Tree < ActiveRecord::Base has_many :nodes, dependent: :destroy end diff --git a/activerecord/test/models/tuning_peg.rb b/activerecord/test/models/tuning_peg.rb index 4fee61c565..1252d6dc1d 100644 --- a/activerecord/test/models/tuning_peg.rb +++ b/activerecord/test/models/tuning_peg.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class TuningPeg < ActiveRecord::Base belongs_to :guitar validates_numericality_of :pitch diff --git a/activerecord/test/models/tyre.rb b/activerecord/test/models/tyre.rb index 03ba9d3364..e50a21ca68 100644 --- a/activerecord/test/models/tyre.rb +++ b/activerecord/test/models/tyre.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Tyre < ActiveRecord::Base belongs_to :car diff --git a/activerecord/test/models/user.rb b/activerecord/test/models/user.rb index 3ceacc5e7f..5089a795f4 100644 --- a/activerecord/test/models/user.rb +++ b/activerecord/test/models/user.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "models/job" class User < ActiveRecord::Base diff --git a/activerecord/test/models/uuid_child.rb b/activerecord/test/models/uuid_child.rb index eaa380ba20..a3d0962ad6 100644 --- a/activerecord/test/models/uuid_child.rb +++ b/activerecord/test/models/uuid_child.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class UuidChild < ActiveRecord::Base belongs_to :uuid_parent end diff --git a/activerecord/test/models/uuid_item.rb b/activerecord/test/models/uuid_item.rb index bb152c381a..2353e40213 100644 --- a/activerecord/test/models/uuid_item.rb +++ b/activerecord/test/models/uuid_item.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class UuidItem < ActiveRecord::Base end diff --git a/activerecord/test/models/uuid_parent.rb b/activerecord/test/models/uuid_parent.rb index f654a964e0..5634f22d0c 100644 --- a/activerecord/test/models/uuid_parent.rb +++ b/activerecord/test/models/uuid_parent.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class UuidParent < ActiveRecord::Base has_many :uuid_children end diff --git a/activerecord/test/models/vegetables.rb b/activerecord/test/models/vegetables.rb index c97b6b939d..a4590d06e0 100644 --- a/activerecord/test/models/vegetables.rb +++ b/activerecord/test/models/vegetables.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Vegetable < ActiveRecord::Base validates_presence_of :name diff --git a/activerecord/test/models/vehicle.rb b/activerecord/test/models/vehicle.rb index 61e18b2e40..855bc4e325 100644 --- a/activerecord/test/models/vehicle.rb +++ b/activerecord/test/models/vehicle.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Vehicle < ActiveRecord::Base self.abstract_class = true default_scope -> { where("tires_count IS NOT NULL") } diff --git a/activerecord/test/models/vertex.rb b/activerecord/test/models/vertex.rb index b90f71cec6..3d19433b6f 100644 --- a/activerecord/test/models/vertex.rb +++ b/activerecord/test/models/vertex.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true # This class models a vertex in a directed graph. class Vertex < ActiveRecord::Base has_many :sink_edges, class_name: "Edge", foreign_key: "source_id" diff --git a/activerecord/test/models/warehouse_thing.rb b/activerecord/test/models/warehouse_thing.rb index 684af49f2f..f20bd1a245 100644 --- a/activerecord/test/models/warehouse_thing.rb +++ b/activerecord/test/models/warehouse_thing.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class WarehouseThing < ActiveRecord::Base self.table_name = "warehouse-things" diff --git a/activerecord/test/models/wheel.rb b/activerecord/test/models/wheel.rb index f2fecf9545..cba2b3e518 100644 --- a/activerecord/test/models/wheel.rb +++ b/activerecord/test/models/wheel.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Wheel < ActiveRecord::Base belongs_to :wheelable, polymorphic: true, counter_cache: true end diff --git a/activerecord/test/models/without_table.rb b/activerecord/test/models/without_table.rb index 77a471e682..7c0fc286e1 100644 --- a/activerecord/test/models/without_table.rb +++ b/activerecord/test/models/without_table.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class WithoutTable < ActiveRecord::Base default_scope -> { where(published: true) } end diff --git a/activerecord/test/models/zine.rb b/activerecord/test/models/zine.rb index 4c72cbb242..3f2b348b46 100644 --- a/activerecord/test/models/zine.rb +++ b/activerecord/test/models/zine.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Zine < ActiveRecord::Base has_many :interests, inverse_of: :zine end diff --git a/activerecord/test/schema/mysql2_specific_schema.rb b/activerecord/test/schema/mysql2_specific_schema.rb index f55b030ebf..90a314c83c 100644 --- a/activerecord/test/schema/mysql2_specific_schema.rb +++ b/activerecord/test/schema/mysql2_specific_schema.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true ActiveRecord::Schema.define do if ActiveRecord::Base.connection.version >= "5.6.0" diff --git a/activerecord/test/schema/oracle_specific_schema.rb b/activerecord/test/schema/oracle_specific_schema.rb index 9129981708..264d9b8910 100644 --- a/activerecord/test/schema/oracle_specific_schema.rb +++ b/activerecord/test/schema/oracle_specific_schema.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true ActiveRecord::Schema.define do execute "drop table test_oracle_defaults" rescue nil diff --git a/activerecord/test/schema/postgresql_specific_schema.rb b/activerecord/test/schema/postgresql_specific_schema.rb index dbf0972b4b..e56e8fa36a 100644 --- a/activerecord/test/schema/postgresql_specific_schema.rb +++ b/activerecord/test/schema/postgresql_specific_schema.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true ActiveRecord::Schema.define do enable_extension!("uuid-ossp", ActiveRecord::Base.connection) diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index d4f029ff16..f534e9c00e 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true ActiveRecord::Schema.define do # ------------------------------------------------------------------- # # # diff --git a/activerecord/test/support/config.rb b/activerecord/test/support/config.rb index e385d7fff7..aaff408b41 100644 --- a/activerecord/test/support/config.rb +++ b/activerecord/test/support/config.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "yaml" require "erb" require "fileutils" diff --git a/activerecord/test/support/connection.rb b/activerecord/test/support/connection.rb index 06a037d3d0..1a609e13c3 100644 --- a/activerecord/test/support/connection.rb +++ b/activerecord/test/support/connection.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/logger" require "models/college" require "models/course" diff --git a/activerecord/test/support/connection_helper.rb b/activerecord/test/support/connection_helper.rb index 5e37a4a991..4a19e5df44 100644 --- a/activerecord/test/support/connection_helper.rb +++ b/activerecord/test/support/connection_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ConnectionHelper def run_without_connection original_connection = ActiveRecord::Base.remove_connection diff --git a/activerecord/test/support/ddl_helper.rb b/activerecord/test/support/ddl_helper.rb index 3a07316637..43cb235e01 100644 --- a/activerecord/test/support/ddl_helper.rb +++ b/activerecord/test/support/ddl_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module DdlHelper def with_example_table(connection, table_name, definition = nil) connection.execute("CREATE TABLE #{table_name}(#{definition})") diff --git a/activerecord/test/support/schema_dumping_helper.rb b/activerecord/test/support/schema_dumping_helper.rb index 1a3f67f3ed..666c1b6a14 100644 --- a/activerecord/test/support/schema_dumping_helper.rb +++ b/activerecord/test/support/schema_dumping_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module SchemaDumpingHelper def dump_table_schema(table, connection = ActiveRecord::Base.connection) old_ignore_tables = ActiveRecord::SchemaDumper.ignore_tables -- cgit v1.2.3 From 0ba55d2e0c251451eede1da069666eb15e86b2c7 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 2 Jul 2017 01:23:28 +0900 Subject: Fix `test_copying_migrations_preserving_magic_comments` Since #29540, `# frozen_string_literal: true` included original migration files. --- activerecord/lib/active_record/migration.rb | 10 ++++++---- activerecord/test/cases/migration_test.rb | 4 ++-- .../test/migrations/magic/1_currencies_have_symbols.rb | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 1ff1dcad43..42220b9a5e 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -863,15 +863,17 @@ module ActiveRecord source_migrations.each do |migration| source = File.binread(migration.filename) inserted_comment = "# This migration comes from #{scope} (originally #{migration.version})\n" - if /\A#.*\b(?:en)?coding:\s*\S+/ =~ source + magic_comments = "".dup + loop do # If we have a magic comment in the original migration, # insert our comment after the first newline(end of the magic comment line) # so the magic keep working. # Note that magic comments must be at the first line(except sh-bang). - source[/\n/] = "\n#{inserted_comment}" - else - source = "#{inserted_comment}#{source}" + source.sub!(/\A(?:#.*\b(?:en)?coding:\s*\S+|#\s*frozen_string_literal:\s*(?:true|false)).*\n/) do |magic_comment| + magic_comments << magic_comment; "" + end || break end + source = "#{magic_comments}#{inserted_comment}#{source}" if duplicate = destination_migrations.detect { |m| m.name == migration.name } if options[:on_skip] && duplicate.scope != scope.to_s diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index 3a49a41580..eff6e09eb7 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -1015,8 +1015,8 @@ class CopyMigrationsTest < ActiveRecord::TestCase assert File.exist?(@migrations_path + "/4_currencies_have_symbols.bukkits.rb") assert_equal [@migrations_path + "/4_currencies_have_symbols.bukkits.rb"], copied.map(&:filename) - expected = "# coding: ISO-8859-15\n# This migration comes from bukkits (originally 1)" - assert_equal expected, IO.readlines(@migrations_path + "/4_currencies_have_symbols.bukkits.rb")[0..1].join.chomp + expected = "# frozen_string_literal: true\n# coding: ISO-8859-15\n# This migration comes from bukkits (originally 1)" + assert_equal expected, IO.readlines(@migrations_path + "/4_currencies_have_symbols.bukkits.rb")[0..2].join.chomp files_count = Dir[@migrations_path + "/*.rb"].length copied = ActiveRecord::Migration.copy(@migrations_path, bukkits: MIGRATIONS_ROOT + "/magic") diff --git a/activerecord/test/migrations/magic/1_currencies_have_symbols.rb b/activerecord/test/migrations/magic/1_currencies_have_symbols.rb index d4b0e6cd95..2ba2875751 100644 --- a/activerecord/test/migrations/magic/1_currencies_have_symbols.rb +++ b/activerecord/test/migrations/magic/1_currencies_have_symbols.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # coding: ISO-8859-15 class CurrenciesHaveSymbols < ActiveRecord::Migration::Current -- cgit v1.2.3 From 608ebccf8f6314c945444b400a37c2d07f21b253 Mon Sep 17 00:00:00 2001 From: eileencodes Date: Sat, 1 Jul 2017 14:22:28 -0400 Subject: Deprecate and replace `set_state` method `set_state` was directly setting the transaction state instance variable. It's better to set the state via specific methods (`rollback!` and `commit!` respectively. While undocumented and untested, it's possible someone is using `set_state` in their app or gem so I've added a deprecation notice to it. No where in the app do we use `nullify!` but I wanted to keep existing behavior while replacing the method with a better pattern. --- activerecord/CHANGELOG.md | 8 +++++ .../connection_adapters/abstract/transaction.rb | 33 +++++++++++++++---- activerecord/test/cases/transactions_test.rb | 38 ++++++++++++++++++++++ 3 files changed, 73 insertions(+), 6 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 824e9d4258..cc1dd324a3 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,11 @@ +* Deprecate `set_state` method in `TransactionState` + + Deprecated the `set_state` method in favor of setting the state via specific methods. If you need to mark the + state of the transaction you can now use `rollback!`, `commit!` or `nullify!` instead of + `set_state(:rolledback)`, `set_state(:committed)`, or `set_state(nil)`. + + *Eileen M. Uchitelle*, *Aaron Patterson* + * Deprecate delegating to `arel` in `Relation`. *Ryuta Kamizono* diff --git a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb index 19b7821494..265775c15c 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb @@ -1,8 +1,6 @@ module ActiveRecord module ConnectionAdapters class TransactionState - VALID_STATES = Set.new([:committed, :rolledback, nil]) - def initialize(state = nil) @state = state end @@ -24,10 +22,33 @@ module ActiveRecord end def set_state(state) - unless VALID_STATES.include?(state) + ActiveSupport::Deprecation.warn(<<-MSG.squish) + The set_state method is deprecated and will be removed in + Rails 5.2. Please use rollback! or commit! to set transaction + state directly. + MSG + case state + when :rolledback + rollback! + when :committed + commit! + when nil + nullify! + else raise ArgumentError, "Invalid transaction state: #{state}" end - @state = state + end + + def rollback! + @state = :rolledback + end + + def commit! + @state = :committed + end + + def nullify! + @state = nil end end @@ -57,7 +78,7 @@ module ActiveRecord end def rollback - @state.set_state(:rolledback) + @state.rollback! end def rollback_records @@ -72,7 +93,7 @@ module ActiveRecord end def commit - @state.set_state(:committed) + @state.commit! end def before_commit_records diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index 79ba306ef5..ce0399fd30 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -725,6 +725,44 @@ class TransactionTest < ActiveRecord::TestCase assert transaction.state.committed? end + def test_set_state_method_is_deprecated + connection = Topic.connection + transaction = ActiveRecord::ConnectionAdapters::TransactionManager.new(connection).begin_transaction + + transaction.commit + + assert_deprecated do + transaction.state.set_state(:rolledback) + end + end + + def test_mark_transaction_state_as_committed + connection = Topic.connection + transaction = ActiveRecord::ConnectionAdapters::TransactionManager.new(connection).begin_transaction + + transaction.rollback + + assert_equal :committed, transaction.state.commit! + end + + def test_mark_transaction_state_as_rolledback + connection = Topic.connection + transaction = ActiveRecord::ConnectionAdapters::TransactionManager.new(connection).begin_transaction + + transaction.commit + + assert_equal :rolledback, transaction.state.rollback! + end + + def test_mark_transaction_state_as_nil + connection = Topic.connection + transaction = ActiveRecord::ConnectionAdapters::TransactionManager.new(connection).begin_transaction + + transaction.commit + + assert_equal nil, transaction.state.nullify! + end + def test_transaction_rollback_with_primarykeyless_tables connection = ActiveRecord::Base.connection connection.create_table(:transaction_without_primary_keys, force: true, id: false) do |t| -- cgit v1.2.3 From 0237da287eb4c507d10a0c6d94150093acc52b03 Mon Sep 17 00:00:00 2001 From: eileencodes Date: Sat, 1 Jul 2017 14:25:33 -0400 Subject: Apply record state based on parent transaction state Let's say you have a nested transaction and both records are saved. Before the outer transaction closes, a rollback is performed. Previously the record in the outer transaction would get marked as not persisted but the inner transaction would get persisted. ```ruby Post.transaction do post_one.save # will get rolled back Post.transaction(requires_new: true) do post_two.save # incorrectly remains marked as persisted end raise ActiveRecord::Rollback end ``` To fix this the PR changes transaction handling to have the child transaction ask the parent how the records should be marked. When there are child transactions, it will always be a SavpointTransaction because the stack isn't empty. From there we pass the parent_transaction to the child SavepointTransaction where we add the children to the parent so the parent can mark the inner transaction as rolledback and thus mark the record as not persisted. `update_attributes_from_transaction_state` uses the `completed?` check to correctly mark all the transactions as rolledback and the inner record as not persisted. ```ruby Post.transaction do post_one.save # will get rolled back Post.transaction(requires_new: true) do post_two.save # with new behavior, correctly marked as not persisted on rollback end raise ActiveRecord::Rollback end ``` Fixes #29320 --- activerecord/CHANGELOG.md | 10 ++++ .../connection_adapters/abstract/transaction.rb | 17 +++++- activerecord/lib/active_record/transactions.rb | 2 +- activerecord/test/cases/transactions_test.rb | 70 ++++++++++++++++++++++ 4 files changed, 96 insertions(+), 3 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index cc1dd324a3..3255eec486 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,13 @@ +* Fix transactions to apply state to child transactions + + Previously if you had a nested transaction and the outer transaction was rolledback the record from the + inner transaction would still be marked as persisted. + + This change fixes that by applying the state of the parent transaction to the child transaction when the + parent transaction is rolledback. This will correctly mark records from the inner transaction as not persisted. + + *Eileen M. Uchitelle*, *Aaron Patterson* + * Deprecate `set_state` method in `TransactionState` Deprecated the `set_state` method in favor of setting the state via specific methods. If you need to mark the diff --git a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb index 265775c15c..2393e35ecd 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb @@ -3,6 +3,11 @@ module ActiveRecord class TransactionState def initialize(state = nil) @state = state + @children = [] + end + + def add_child(state) + @children << state end def finalized? @@ -17,6 +22,10 @@ module ActiveRecord @state == :rolledback end + def fully_completed? + completed? + end + def completed? committed? || rolledback? end @@ -40,6 +49,7 @@ module ActiveRecord end def rollback! + @children.each { |c| c.rollback! } @state = :rolledback end @@ -121,8 +131,11 @@ module ActiveRecord end class SavepointTransaction < Transaction - def initialize(connection, savepoint_name, options, *args) + def initialize(connection, savepoint_name, parent_transaction, options, *args) super(connection, options, *args) + + parent_transaction.state.add_child(@state) + if options[:isolation] raise ActiveRecord::TransactionIsolationError, "cannot set transaction isolation in a nested transaction" end @@ -176,7 +189,7 @@ module ActiveRecord if @stack.empty? RealTransaction.new(@connection, options, run_commit_callbacks: run_commit_callbacks) else - SavepointTransaction.new(@connection, "active_record_#{@stack.size}", options, + SavepointTransaction.new(@connection, "active_record_#{@stack.size}", @stack.last, options, run_commit_callbacks: run_commit_callbacks) end diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb index 45795fa287..463bb1f314 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -490,7 +490,7 @@ module ActiveRecord def update_attributes_from_transaction_state(transaction_state) if transaction_state && transaction_state.finalized? restore_transaction_record_state if transaction_state.rolledback? - clear_transaction_record_state + clear_transaction_record_state if transaction_state.fully_completed? end end end diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index ce0399fd30..82c369f252 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -304,6 +304,76 @@ class TransactionTest < ActiveRecord::TestCase assert !Topic.find(2).approved?, "Second should have been unapproved" end + def test_nested_transaction_with_new_transaction_applies_parent_state_on_rollback + topic_one = Topic.new(title: "A new topic") + topic_two = Topic.new(title: "Another new topic") + + Topic.transaction do + topic_one.save + + Topic.transaction(requires_new: true) do + topic_two.save + + assert_predicate topic_one, :persisted? + assert_predicate topic_two, :persisted? + end + + raise ActiveRecord::Rollback + end + + refute_predicate topic_one, :persisted? + refute_predicate topic_two, :persisted? + end + + def test_nested_transaction_without_new_transaction_applies_parent_state_on_rollback + topic_one = Topic.new(title: "A new topic") + topic_two = Topic.new(title: "Another new topic") + + Topic.transaction do + topic_one.save + + Topic.transaction do + topic_two.save + + assert_predicate topic_one, :persisted? + assert_predicate topic_two, :persisted? + end + + raise ActiveRecord::Rollback + end + + refute_predicate topic_one, :persisted? + refute_predicate topic_two, :persisted? + end + + def test_double_nested_transaction_applies_parent_state_on_rollback + topic_one = Topic.new(title: "A new topic") + topic_two = Topic.new(title: "Another new topic") + topic_three = Topic.new(title: "Another new topic of course") + + Topic.transaction do + topic_one.save + + Topic.transaction do + topic_two.save + + Topic.transaction do + topic_three.save + end + end + + assert_predicate topic_one, :persisted? + assert_predicate topic_two, :persisted? + assert_predicate topic_three, :persisted? + + raise ActiveRecord::Rollback + end + + refute_predicate topic_one, :persisted? + refute_predicate topic_two, :persisted? + refute_predicate topic_three, :persisted? + end + def test_manually_rolling_back_a_transaction Topic.transaction do @first.approved = true -- cgit v1.2.3 From 27996bc1fb3ad2115a3e091240c6eec79898fd8c Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 2 Jul 2017 04:11:48 +0900 Subject: Fix removed version 5.2 to 6.0 in the deprecation message Because the deprecation message is not yet released. --- .../lib/active_record/connection_adapters/abstract/transaction.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb index 2393e35ecd..f63d09039f 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb @@ -33,7 +33,7 @@ module ActiveRecord def set_state(state) ActiveSupport::Deprecation.warn(<<-MSG.squish) The set_state method is deprecated and will be removed in - Rails 5.2. Please use rollback! or commit! to set transaction + Rails 6.0. Please use rollback! or commit! to set transaction state directly. MSG case state -- cgit v1.2.3 From ad31335971097b417f8d4400d22b8f140cd24ead Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Sun, 2 Jul 2017 23:10:02 +0900 Subject: :warning: "Use assert_nil if expecting nil. This will fail in Minitest 6." --- activerecord/test/cases/transactions_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index 82c369f252..76a997ba8b 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -830,7 +830,7 @@ class TransactionTest < ActiveRecord::TestCase transaction.commit - assert_equal nil, transaction.state.nullify! + assert_nil transaction.state.nullify! end def test_transaction_rollback_with_primarykeyless_tables -- cgit v1.2.3 From 6aa658e329e54f94519268a02b29dc102b415c07 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Mon, 3 Jul 2017 00:16:53 +0900 Subject: Remove redundant `assert_respond_to` It is covered by following assertion. --- .../associations/inverse_associations_test.rb | 26 ---------------------- 1 file changed, 26 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/associations/inverse_associations_test.rb b/activerecord/test/cases/associations/inverse_associations_test.rb index 8e3087e7ca..9fbaa43274 100644 --- a/activerecord/test/cases/associations/inverse_associations_test.rb +++ b/activerecord/test/cases/associations/inverse_associations_test.rb @@ -24,11 +24,9 @@ class AutomaticInverseFindingTests < ActiveRecord::TestCase monkey_reflection = MixedCaseMonkey.reflect_on_association(:man) man_reflection = Man.reflect_on_association(:mixed_case_monkey) - assert_respond_to monkey_reflection, :has_inverse? assert monkey_reflection.has_inverse?, "The monkey reflection should have an inverse" assert_equal man_reflection, monkey_reflection.inverse_of, "The monkey reflection's inverse should be the man reflection" - assert_respond_to man_reflection, :has_inverse? assert man_reflection.has_inverse?, "The man reflection should have an inverse" assert_equal monkey_reflection, man_reflection.inverse_of, "The man reflection's inverse should be the monkey reflection" end @@ -37,7 +35,6 @@ class AutomaticInverseFindingTests < ActiveRecord::TestCase account_reflection = Admin::Account.reflect_on_association(:users) user_reflection = Admin::User.reflect_on_association(:account) - assert_respond_to account_reflection, :has_inverse? assert account_reflection.has_inverse?, "The Admin::Account reflection should have an inverse" assert_equal user_reflection, account_reflection.inverse_of, "The Admin::Account reflection's inverse should be the Admin::User reflection" end @@ -46,11 +43,9 @@ class AutomaticInverseFindingTests < ActiveRecord::TestCase car_reflection = Car.reflect_on_association(:bulb) bulb_reflection = Bulb.reflect_on_association(:car) - assert_respond_to car_reflection, :has_inverse? assert car_reflection.has_inverse?, "The Car reflection should have an inverse" assert_equal bulb_reflection, car_reflection.inverse_of, "The Car reflection's inverse should be the Bulb reflection" - assert_respond_to bulb_reflection, :has_inverse? assert bulb_reflection.has_inverse?, "The Bulb reflection should have an inverse" assert_equal car_reflection, bulb_reflection.inverse_of, "The Bulb reflection's inverse should be the Car reflection" end @@ -59,7 +54,6 @@ class AutomaticInverseFindingTests < ActiveRecord::TestCase comment_reflection = Comment.reflect_on_association(:ratings) rating_reflection = Rating.reflect_on_association(:comment) - assert_respond_to comment_reflection, :has_inverse? assert comment_reflection.has_inverse?, "The Comment reflection should have an inverse" assert_equal rating_reflection, comment_reflection.inverse_of, "The Comment reflection's inverse should be the Rating reflection" end @@ -107,19 +101,16 @@ class AutomaticInverseFindingTests < ActiveRecord::TestCase def test_polymorphic_and_has_many_through_relationships_should_not_have_inverses sponsor_reflection = Sponsor.reflect_on_association(:sponsorable) - assert_respond_to sponsor_reflection, :has_inverse? assert !sponsor_reflection.has_inverse?, "A polymorphic association should not find an inverse automatically" club_reflection = Club.reflect_on_association(:members) - assert_respond_to club_reflection, :has_inverse? assert !club_reflection.has_inverse?, "A has_many_through association should not find an inverse automatically" end def test_polymorphic_has_one_should_find_inverse_automatically man_reflection = Man.reflect_on_association(:polymorphic_face_without_inverse) - assert_respond_to man_reflection, :has_inverse? assert man_reflection.has_inverse? end end @@ -141,41 +132,24 @@ class InverseAssociationTests < ActiveRecord::TestCase def test_should_be_able_to_ask_a_reflection_if_it_has_an_inverse has_one_with_inverse_ref = Man.reflect_on_association(:face) - assert_respond_to has_one_with_inverse_ref, :has_inverse? assert has_one_with_inverse_ref.has_inverse? has_many_with_inverse_ref = Man.reflect_on_association(:interests) - assert_respond_to has_many_with_inverse_ref, :has_inverse? assert has_many_with_inverse_ref.has_inverse? belongs_to_with_inverse_ref = Face.reflect_on_association(:man) - assert_respond_to belongs_to_with_inverse_ref, :has_inverse? assert belongs_to_with_inverse_ref.has_inverse? has_one_without_inverse_ref = Club.reflect_on_association(:sponsor) - assert_respond_to has_one_without_inverse_ref, :has_inverse? assert !has_one_without_inverse_ref.has_inverse? has_many_without_inverse_ref = Club.reflect_on_association(:memberships) - assert_respond_to has_many_without_inverse_ref, :has_inverse? assert !has_many_without_inverse_ref.has_inverse? belongs_to_without_inverse_ref = Sponsor.reflect_on_association(:sponsor_club) - assert_respond_to belongs_to_without_inverse_ref, :has_inverse? assert !belongs_to_without_inverse_ref.has_inverse? end - def test_should_be_able_to_ask_a_reflection_what_it_is_the_inverse_of - has_one_ref = Man.reflect_on_association(:face) - assert_respond_to has_one_ref, :inverse_of - - has_many_ref = Man.reflect_on_association(:interests) - assert_respond_to has_many_ref, :inverse_of - - belongs_to_ref = Face.reflect_on_association(:man) - assert_respond_to belongs_to_ref, :inverse_of - end - def test_inverse_of_method_should_supply_the_actual_reflection_instance_it_is_the_inverse_of has_one_ref = Man.reflect_on_association(:face) assert_equal Face.reflect_on_association(:man), has_one_ref.inverse_of -- cgit v1.2.3 From 4b29d9f1db0dd8fc95829cfefed0687242cfc12b Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Mon, 3 Jul 2017 23:58:12 +0900 Subject: Add backticks [ci skip] --- activerecord/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 3255eec486..7404c1bd8f 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -24,7 +24,7 @@ *Ryuta Kamizono* -* Query cache was unavailable when entering the ActiveRecord::Base.cache block +* Query cache was unavailable when entering the `ActiveRecord::Base.cache` block without being connected. *Tsukasa Oishi* @@ -58,7 +58,7 @@ *bogdanvlviv* * Fix destroying existing object does not work well when optimistic locking enabled and - `locking column` is null in the database. + `locking_column` is null in the database. *bogdanvlviv* -- cgit v1.2.3 From 4aa76ed38a8609ad713e2b39ccb1fa97c5c64682 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 30 Apr 2017 01:00:59 +0900 Subject: Remove unused `association_key` and `table` methods in `Preloader::Association` These are no longer used since b98668decb9712f26118de57623fd15d7d28646d. --- .../lib/active_record/associations/preloader/association.rb | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/preloader/association.rb b/activerecord/lib/active_record/associations/preloader/association.rb index 63ef3f2d8c..4513dce15e 100644 --- a/activerecord/lib/active_record/associations/preloader/association.rb +++ b/activerecord/lib/active_record/associations/preloader/association.rb @@ -31,21 +31,11 @@ module ActiveRecord scope.where(association_key_name => ids) end - def table - klass.arel_table - end - # The name of the key on the associated records def association_key_name raise NotImplementedError end - # This is overridden by HABTM as the condition should be on the foreign_key column in - # the join table - def association_key - klass.arel_attribute(association_key_name, table) - end - # The name of the key on the model which declares the association def owner_key_name raise NotImplementedError -- cgit v1.2.3 From 2bfa2c02a891d4817832807343c6f1d56e9bae50 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 18 May 2017 10:42:26 +0900 Subject: Fix preloading association with scope including joins --- .../lib/active_record/associations/preloader.rb | 3 -- .../associations/preloader/association.rb | 58 ++++++---------------- .../associations/preloader/through_association.rb | 13 +++-- activerecord/test/cases/associations/eager_test.rb | 4 ++ activerecord/test/models/club.rb | 2 + activerecord/test/models/member.rb | 1 + 6 files changed, 32 insertions(+), 49 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/preloader.rb b/activerecord/lib/active_record/associations/preloader.rb index 208d1b2670..a18994cec4 100644 --- a/activerecord/lib/active_record/associations/preloader.rb +++ b/activerecord/lib/active_record/associations/preloader.rb @@ -54,8 +54,6 @@ module ActiveRecord autoload :BelongsTo, "active_record/associations/preloader/belongs_to" end - NULL_RELATION = Struct.new(:values, :where_clause, :joins_values).new({}, Relation::WhereClause.empty, []) - # Eager loads the named associations for the given Active Record record(s). # # In this description, 'association name' shall refer to the name passed @@ -93,7 +91,6 @@ module ActiveRecord def preload(records, associations, preload_scope = nil) records = Array.wrap(records).compact.uniq associations = Array.wrap(associations) - preload_scope = preload_scope || NULL_RELATION if records.empty? [] diff --git a/activerecord/lib/active_record/associations/preloader/association.rb b/activerecord/lib/active_record/associations/preloader/association.rb index 4513dce15e..85343040db 100644 --- a/activerecord/lib/active_record/associations/preloader/association.rb +++ b/activerecord/lib/active_record/associations/preloader/association.rb @@ -11,7 +11,6 @@ module ActiveRecord @reflection = reflection @preload_scope = preload_scope @model = owners.first && owners.first.class - @scope = nil @preloaded_records = [] end @@ -23,14 +22,6 @@ module ActiveRecord raise NotImplementedError end - def scope - @scope ||= build_scope - end - - def records_for(ids) - scope.where(association_key_name => ids) - end - # The name of the key on the associated records def association_key_name raise NotImplementedError @@ -104,54 +95,35 @@ module ActiveRecord # Make several smaller queries if necessary or make one query if the adapter supports it slices = owner_keys.each_slice(klass.connection.in_clause_length || owner_keys.size) @preloaded_records = slices.flat_map do |slice| - records_for(slice).load(&block) + records_for(slice, &block) end @preloaded_records.group_by do |record| convert_key(record[association_key_name]) end end + def records_for(ids, &block) + scope.where(association_key_name => ids).load(&block) + end + + def scope + @scope ||= build_scope + end + def reflection_scope @reflection_scope ||= reflection.scope_for(klass) end def build_scope - scope = klass.unscoped - - values = reflection_scope.values - preload_values = preload_scope.values - - scope.where_clause = reflection_scope.where_clause + preload_scope.where_clause - scope.references_values = Array(values[:references]) + Array(preload_values[:references]) - - if preload_values[:select] || values[:select] - scope._select!(preload_values[:select] || values[:select]) - end - scope.includes! preload_values[:includes] || values[:includes] - if preload_scope.joins_values.any? - scope.joins!(preload_scope.joins_values) - else - scope.joins!(reflection_scope.joins_values) - end - - if order_values = preload_values[:order] || values[:order] - scope.order!(order_values) - end - - if preload_values[:reordering] || values[:reordering] - scope.reordering_value = true - end - - if preload_values[:readonly] || values[:readonly] - scope.readonly! - end + scope = klass.default_scoped - if options[:as] - scope.where!(klass.table_name => { reflection.type => model.base_class.sti_name }) + if reflection.type + scope.where!(reflection.type => model.base_class.sti_name) end - scope.unscope_values = Array(values[:unscope]) + Array(preload_values[:unscope]) - klass.default_scoped.merge(scope) + scope.merge!(reflection_scope) + scope.merge!(preload_scope) if preload_scope + scope end end end diff --git a/activerecord/lib/active_record/associations/preloader/through_association.rb b/activerecord/lib/active_record/associations/preloader/through_association.rb index 34587fd3f5..0999746cd5 100644 --- a/activerecord/lib/active_record/associations/preloader/through_association.rb +++ b/activerecord/lib/active_record/associations/preloader/through_association.rb @@ -79,17 +79,24 @@ module ActiveRecord def through_scope scope = through_reflection.klass.unscoped + values = reflection_scope.values if options[:source_type] scope.where! reflection.foreign_type => options[:source_type] else unless reflection_scope.where_clause.empty? - scope.includes_values = Array(reflection_scope.values[:includes] || options[:source]) + scope.includes_values = Array(values[:includes] || options[:source]) scope.where_clause = reflection_scope.where_clause + if joins = values[:joins] + scope.joins!(source_reflection.name => joins) + end + if left_outer_joins = values[:left_outer_joins] + scope.left_outer_joins!(source_reflection.name => left_outer_joins) + end end - scope.references! reflection_scope.values[:references] - if scope.eager_loading? && order_values = reflection_scope.values[:order] + scope.references! values[:references] + if scope.eager_loading? && order_values = values[:order] scope = scope.order(order_values) end end diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index 55b294cfaa..db8248dd99 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -68,6 +68,10 @@ class EagerAssociationTest < ActiveRecord::TestCase "expected to find only david's posts" end + def test_loading_with_scope_including_joins + assert_equal clubs(:boring_club), Member.preload(:general_club).find(1).general_club + end + def test_with_ordering list = Post.all.merge!(includes: :comments, order: "posts.id DESC").to_a [:other_by_mary, :other_by_bob, :misc_by_mary, :misc_by_bob, :eager_other, diff --git a/activerecord/test/models/club.rb b/activerecord/test/models/club.rb index 49d7b24a3b..3d441b1d48 100644 --- a/activerecord/test/models/club.rb +++ b/activerecord/test/models/club.rb @@ -8,6 +8,8 @@ class Club < ActiveRecord::Base has_many :favourites, -> { where(memberships: { favourite: true }) }, through: :memberships, source: :member + scope :general, -> { left_joins(:category).where(categories: { name: "General" }) } + private def private_method diff --git a/activerecord/test/models/member.rb b/activerecord/test/models/member.rb index 36f2461b84..b9597c6b9a 100644 --- a/activerecord/test/models/member.rb +++ b/activerecord/test/models/member.rb @@ -22,6 +22,7 @@ class Member < ActiveRecord::Base has_many :organization_member_details_2, through: :organization, source: :member_details has_one :club_category, through: :club, source: :category + has_one :general_club, -> { general }, through: :current_membership, source: :club has_many :current_memberships, -> { where favourite: true } has_many :clubs, through: :current_memberships -- cgit v1.2.3 From db3ff259ea7c9b4c3660c0476e847907f90b762e Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 11 Jun 2017 20:13:21 +0900 Subject: Fix eager loading association with scope including joins Fixes #28324. --- activerecord/CHANGELOG.md | 6 ++++++ .../associations/join_dependency/join_association.rb | 14 ++++++++++---- activerecord/lib/active_record/reflection.rb | 18 +++++++++++------- activerecord/test/cases/associations/eager_test.rb | 1 + 4 files changed, 28 insertions(+), 11 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 7404c1bd8f..8d900d9669 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,9 @@ +* Fix eager loading/preloading association with scope including joins. + + Fixes #28324. + + *Ryuta Kamizono* + * Fix transactions to apply state to child transactions Previously if you had a nested transaction and the outer transaction was rolledback the record from the diff --git a/activerecord/lib/active_record/associations/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/join_dependency/join_association.rb index d0c1848079..b14ddfeeeb 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb @@ -34,13 +34,19 @@ module ActiveRecord table = tables.shift klass = reflection.klass - join_scope = reflection.join_scope(table, foreign_table, foreign_klass) - - binds.concat join_scope.bound_attributes - constraint = join_scope.arel.constraints + constraint = reflection.build_join_constraint(table, foreign_table) joins << table.create_join(table, table.create_on(constraint), join_type) + join_scope = reflection.join_scope(table, foreign_klass) + + if join_scope.arel.constraints.any? + binds.concat join_scope.bound_attributes + joins.concat join_scope.arel.join_sources + right = joins.last.right + right.expr = right.expr.and(join_scope.arel.constraints) + end + # The current table in this iteration becomes the foreign table in the next foreign_table, foreign_klass = table, klass end diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 8ff2f50fdb..a453ca55c7 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -185,19 +185,23 @@ module ActiveRecord end deprecate :scope_chain - def join_scope(table, foreign_table, foreign_klass) - predicate_builder = predicate_builder(table) - scope_chain_items = join_scopes(table, predicate_builder) - klass_scope = klass_join_scope(table, predicate_builder) - + def build_join_constraint(table, foreign_table) key = join_keys.key foreign_key = join_keys.foreign_key - klass_scope.where!(table[key].eq(foreign_table[foreign_key])) + constraint = table[key].eq(foreign_table[foreign_key]) if klass.finder_needs_type_condition? - klass_scope.where!(klass.send(:type_condition, table)) + table.create_and([constraint, klass.send(:type_condition, table)]) + else + constraint end + end + + def join_scope(table, foreign_klass) + predicate_builder = predicate_builder(table) + scope_chain_items = join_scopes(table, predicate_builder) + klass_scope = klass_join_scope(table, predicate_builder) if type klass_scope.where!(type => foreign_klass.base_class.sti_name) diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index db8248dd99..c0bab19e82 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -70,6 +70,7 @@ class EagerAssociationTest < ActiveRecord::TestCase def test_loading_with_scope_including_joins assert_equal clubs(:boring_club), Member.preload(:general_club).find(1).general_club + assert_equal clubs(:boring_club), Member.eager_load(:general_club).find(1).general_club end def test_with_ordering -- cgit v1.2.3 From 99b4c4ccdbbfc54a9f5eb8809edae9392e4ab2ab Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Tue, 4 Jul 2017 11:38:07 +0900 Subject: Add missing `attr_name.to_s` in `AttributeMutationTracker` `attributes` (`values` in `LazyAttributeHash` in `AttributeSet`) has string keys, not symbols. Fixes #29665. --- activerecord/lib/active_record/attribute_mutation_tracker.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/attribute_mutation_tracker.rb b/activerecord/lib/active_record/attribute_mutation_tracker.rb index 4de993e169..a01a58f8a5 100644 --- a/activerecord/lib/active_record/attribute_mutation_tracker.rb +++ b/activerecord/lib/active_record/attribute_mutation_tracker.rb @@ -26,6 +26,7 @@ module ActiveRecord end def change_to_attribute(attr_name) + attr_name = attr_name.to_s if changed?(attr_name) [attributes[attr_name].original_value, attributes.fetch_value(attr_name)] end @@ -44,7 +45,7 @@ module ActiveRecord end def changed_in_place?(attr_name) - attributes[attr_name].changed_in_place? + attributes[attr_name.to_s].changed_in_place? end def forget_change(attr_name) @@ -54,7 +55,7 @@ module ActiveRecord end def original_value(attr_name) - attributes[attr_name].original_value + attributes[attr_name.to_s].original_value end def force_change(attr_name) -- cgit v1.2.3 From 2568414f49cc74522569941004104289d0175e72 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Tue, 4 Jul 2017 09:04:51 +0900 Subject: Remove database specific JSON types We already have database agnostic `Type::Json` since #29220. --- .../connection_adapters/abstract_mysql_adapter.rb | 3 --- .../lib/active_record/connection_adapters/postgresql/oid.rb | 1 - .../active_record/connection_adapters/postgresql/oid/json.rb | 10 ---------- 3 files changed, 14 deletions(-) delete mode 100644 activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index caa125576c..c15b4a1a05 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -854,9 +854,6 @@ module ActiveRecord end end - class MysqlJson < Type::Json # :nodoc: - end - class MysqlString < Type::String # :nodoc: def serialize(value) case value diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb index 0e8888a2b7..6666622c08 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb @@ -8,7 +8,6 @@ require_relative "oid/decimal" require_relative "oid/enum" require_relative "oid/hstore" require_relative "oid/inet" -require_relative "oid/json" require_relative "oid/jsonb" require_relative "oid/money" require_relative "oid/oid" diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb deleted file mode 100644 index 3c706c27c4..0000000000 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb +++ /dev/null @@ -1,10 +0,0 @@ -module ActiveRecord - module ConnectionAdapters - module PostgreSQL - module OID # :nodoc: - class Json < Type::Json # :nodoc: - end - end - end - end -end -- cgit v1.2.3 From 7b2dfdeab6e4ef096e4dc1fe313056f08ccf7dc5 Mon Sep 17 00:00:00 2001 From: Lisa Ugray Date: Tue, 4 Jul 2017 14:22:35 -0400 Subject: Fix `ActiveModel::Type::DateTime#serialize` `ActiveModel::Type::DateTime#serialize` should return a `Time` object so that finding by a datetime column works correctly. --- activerecord/test/cases/date_time_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'activerecord') diff --git a/activerecord/test/cases/date_time_test.rb b/activerecord/test/cases/date_time_test.rb index ad7da9de70..6cd98fe254 100644 --- a/activerecord/test/cases/date_time_test.rb +++ b/activerecord/test/cases/date_time_test.rb @@ -58,4 +58,17 @@ class DateTimeTest < ActiveRecord::TestCase assert_equal now, task.starting end end + + def test_date_time_with_string_value_with_subsecond_precision + skip unless subsecond_precision_supported? + string_value = "2017-07-04 14:19:00.5" + topic = Topic.create(written_on: string_value) + assert_equal topic, Topic.find_by(written_on: string_value) + end + + def test_date_time_with_string_value_with_non_iso_format + string_value = "04/07/2017 2:19pm" + topic = Topic.create(written_on: string_value) + assert_equal topic, Topic.find_by(written_on: string_value) + end end -- cgit v1.2.3 From ad0bde58d4e5dd3686fdbdc21c7e4b6d71e371e4 Mon Sep 17 00:00:00 2001 From: Dennis Taylor Date: Wed, 5 Jul 2017 15:21:25 -0700 Subject: Don't translate non-database exceptions. The AbstractAdapter will translate all StandardErrors generated during the course of a query into ActiveRecord::StatementInvalids. Unfortunately, it'll also mangle non-database-related errors generated in ActiveSupport::Notification callbacks after the query has successfully completed. This should prevent it from translating errors from ActiveSupport::Notifications. --- activerecord/CHANGELOG.md | 5 ++++ .../connection_adapters/abstract_adapter.rb | 6 +++-- activerecord/test/cases/adapter_test.rb | 30 ++++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 8d900d9669..b5457e389b 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,8 @@ +* Prevent AbstractAdapter from converting exceptions from ActiveSupport::Notification + callbacks into ActiveRecord::StatementInvalids. + + *Dennis Taylor* + * Fix eager loading/preloading association with scope including joins. Fixes #28324. diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index cfe1892d78..30b29e7007 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -576,12 +576,14 @@ module ActiveRecord type_casted_binds: type_casted_binds, statement_name: statement_name, connection_id: object_id) do + begin @lock.synchronize do yield end + rescue => e + raise translate_exception_class(e, sql) end - rescue => e - raise translate_exception_class(e, sql) + end end def translate_exception(exception, message) diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb index a1fb6427f9..6d211d5768 100644 --- a/activerecord/test/cases/adapter_test.rb +++ b/activerecord/test/cases/adapter_test.rb @@ -211,6 +211,28 @@ module ActiveRecord end end + def test_exceptions_from_notifications_are_not_translated + original_error = RuntimeError.new("This RuntimeError shouldn't get translated") + subscriber = ActiveSupport::Notifications.subscribe("sql.active_record") { raise original_error } + actual_error = assert_raises(RuntimeError) do + @connection.execute("SELECT * FROM posts") + end + + assert_equal original_error, actual_error + + ensure + ActiveSupport::Notifications.unsubscribe(subscriber) if subscriber + end + + def test_other_exceptions_are_translated_to_statement_invalid + error = assert_raises(ActiveRecord::StatementInvalid) do + @connection.execute("This is a syntax error") + end + + assert_instance_of ActiveRecord::StatementInvalid, error + assert_instance_of syntax_error_exception_class, error.cause + end + def test_select_all_always_return_activerecord_result result = @connection.select_all "SELECT * FROM posts" assert result.is_a?(ActiveRecord::Result) @@ -261,6 +283,14 @@ module ActiveRecord assert_not_nil error.message end end + + private + + def syntax_error_exception_class + return Mysql2::Error if defined?(Mysql2) + return PG::SyntaxError if defined?(PG) + return SQLite3::SQLException if defined?(SQLite3) + end end class AdapterForeignKeyTest < ActiveRecord::TestCase -- cgit v1.2.3 From 06e89c922c770f81c98c68eed9a4bfd96e6770c7 Mon Sep 17 00:00:00 2001 From: Dennis Taylor Date: Wed, 5 Jul 2017 17:13:37 -0700 Subject: Fix indentation style for private method. --- activerecord/test/cases/adapter_test.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb index 6d211d5768..2236039ff7 100644 --- a/activerecord/test/cases/adapter_test.rb +++ b/activerecord/test/cases/adapter_test.rb @@ -286,11 +286,11 @@ module ActiveRecord private - def syntax_error_exception_class - return Mysql2::Error if defined?(Mysql2) - return PG::SyntaxError if defined?(PG) - return SQLite3::SQLException if defined?(SQLite3) - end + def syntax_error_exception_class + return Mysql2::Error if defined?(Mysql2) + return PG::SyntaxError if defined?(PG) + return SQLite3::SQLException if defined?(SQLite3) + end end class AdapterForeignKeyTest < ActiveRecord::TestCase -- cgit v1.2.3 From 6658e3746b236f84e27e711fced6a83b187ad2b1 Mon Sep 17 00:00:00 2001 From: Eugene Kenny Date: Mon, 24 Apr 2017 21:10:47 +0100 Subject: Skip query cache for in_batches and friends The `find_each`, `find_in_batches` and `in_batches` APIs usually operate on large numbers of records, where it's preferable not to load them all into memory at once. If the query cache is enabled, it will hold onto the query results until the end of the execution context (request/job), which means the memory used is still proportional to the total number of records. These queries are typically not repeated, so the query cache isn't desirable here. --- activerecord/lib/active_record/relation.rb | 38 +++++++++----- activerecord/lib/active_record/relation/batches.rb | 1 + .../lib/active_record/relation/calculations.rb | 6 +-- .../lib/active_record/relation/finder_methods.rb | 6 +-- .../lib/active_record/relation/query_methods.rb | 5 ++ activerecord/test/cases/batches_test.rb | 61 ++++++++++++++++++++++ activerecord/test/cases/calculations_test.rb | 42 +++++++++++++++ activerecord/test/cases/finder_test.rb | 28 ++++++++++ activerecord/test/cases/relation/mutation_test.rb | 7 ++- activerecord/test/cases/relations_test.rb | 42 +++++++++++++++ 10 files changed, 216 insertions(+), 20 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 52f5d5f3e3..76cf47a3ed 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -6,7 +6,7 @@ module ActiveRecord :extending, :unscope] SINGLE_VALUE_METHODS = [:limit, :offset, :lock, :readonly, :reordering, - :reverse_order, :distinct, :create_with] + :reverse_order, :distinct, :create_with, :skip_query_cache] CLAUSE_METHODS = [:where, :having, :from] INVALID_METHODS_FOR_DELETE_ALL = [:limit, :distinct, :offset, :group, :having] @@ -657,20 +657,32 @@ module ActiveRecord end def exec_queries(&block) - @records = eager_loading? ? find_with_associations.freeze : @klass.find_by_sql(arel, bound_attributes, &block).freeze - - preload = preload_values - preload += includes_values unless eager_loading? - preloader = nil - preload.each do |associations| - preloader ||= build_preloader - preloader.preload @records, associations - end + skip_query_cache_if_necessary do + @records = eager_loading? ? find_with_associations.freeze : @klass.find_by_sql(arel, bound_attributes, &block).freeze + + preload = preload_values + preload += includes_values unless eager_loading? + preloader = nil + preload.each do |associations| + preloader ||= build_preloader + preloader.preload @records, associations + end - @records.each(&:readonly!) if readonly_value + @records.each(&:readonly!) if readonly_value - @loaded = true - @records + @loaded = true + @records + end + end + + def skip_query_cache_if_necessary + if skip_query_cache_value + uncached do + yield + end + else + yield + end end def build_preloader diff --git a/activerecord/lib/active_record/relation/batches.rb b/activerecord/lib/active_record/relation/batches.rb index ee1f25ec84..c7e4f8a88a 100644 --- a/activerecord/lib/active_record/relation/batches.rb +++ b/activerecord/lib/active_record/relation/batches.rb @@ -209,6 +209,7 @@ module ActiveRecord relation = relation.reorder(batch_order).limit(batch_limit) relation = apply_limits(relation, start, finish) + relation.skip_query_cache! # Retaining the results in the query cache would undermine the point of batching batch_relation = relation loop do diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 8a54f8f2c3..aaba6c71f2 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -184,7 +184,7 @@ module ActiveRecord relation.select_values = column_names.map { |cn| @klass.has_attribute?(cn) || @klass.attribute_alias?(cn) ? arel_attribute(cn) : cn } - result = klass.connection.select_all(relation.arel, nil, bound_attributes) + result = skip_query_cache_if_necessary { klass.connection.select_all(relation.arel, nil, bound_attributes) } result.cast_values(klass.attribute_types) end end @@ -260,7 +260,7 @@ module ActiveRecord query_builder = relation.arel end - result = @klass.connection.select_all(query_builder, nil, bound_attributes) + result = skip_query_cache_if_necessary { @klass.connection.select_all(query_builder, nil, bound_attributes) } row = result.first value = row && row.values.first type = result.column_types.fetch(column_alias) do @@ -311,7 +311,7 @@ module ActiveRecord relation.group_values = group_fields relation.select_values = select_values - calculated_data = @klass.connection.select_all(relation.arel, nil, relation.bound_attributes) + calculated_data = skip_query_cache_if_necessary { @klass.connection.select_all(relation.arel, nil, relation.bound_attributes) } if association key_ids = calculated_data.collect { |row| row[group_aliases.first] } diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index eee0f36f63..ac0b4f597e 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -315,7 +315,7 @@ module ActiveRecord relation = construct_relation_for_exists(relation, conditions) - connection.select_value(relation.arel, "#{name} Exists", relation.bound_attributes) ? true : false + skip_query_cache_if_necessary { connection.select_value(relation.arel, "#{name} Exists", relation.bound_attributes) } ? true : false rescue ::RangeError false end @@ -376,7 +376,7 @@ module ActiveRecord if ActiveRecord::NullRelation === relation [] else - rows = connection.select_all(relation.arel, "SQL", relation.bound_attributes) + rows = skip_query_cache_if_necessary { connection.select_all(relation.arel, "SQL", relation.bound_attributes) } join_dependency.instantiate(rows, aliases) end end @@ -424,7 +424,7 @@ module ActiveRecord relation = relation.except(:select).select(values).distinct! - id_rows = @klass.connection.select_all(relation.arel, "SQL", relation.bound_attributes) + id_rows = skip_query_cache_if_necessary { @klass.connection.select_all(relation.arel, "SQL", relation.bound_attributes) } id_rows.map { |row| row[primary_key] } end diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 9da8f96337..79495ead91 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -913,6 +913,11 @@ module ActiveRecord self end + def skip_query_cache! # :nodoc: + self.skip_query_cache_value = true + self + end + # Returns the Arel object associated with the relation. def arel # :nodoc: @arel ||= build_arel diff --git a/activerecord/test/cases/batches_test.rb b/activerecord/test/cases/batches_test.rb index 1a66b82b2e..dcd3af487b 100644 --- a/activerecord/test/cases/batches_test.rb +++ b/activerecord/test/cases/batches_test.rb @@ -1,4 +1,5 @@ require "cases/helper" +require "models/comment" require "models/post" require "models/subscriber" @@ -610,4 +611,64 @@ class EachTest < ActiveRecord::TestCase end assert_equal expected, actual end + + test ".find_each bypasses the query cache for its own queries" do + Post.cache do + assert_queries(2) do + Post.find_each {} + Post.find_each {} + end + end + end + + test ".find_each does not disable the query cache inside the given block" do + Post.cache do + Post.find_each(start: 1, finish: 1) do |post| + assert_queries(1) do + post.comments.count + post.comments.count + end + end + end + end + + test ".find_in_batches bypasses the query cache for its own queries" do + Post.cache do + assert_queries(2) do + Post.find_in_batches {} + Post.find_in_batches {} + end + end + end + + test ".find_in_batches does not disable the query cache inside the given block" do + Post.cache do + Post.find_in_batches(start: 1, finish: 1) do |batch| + assert_queries(1) do + batch.first.comments.count + batch.first.comments.count + end + end + end + end + + test ".in_batches bypasses the query cache for its own queries" do + Post.cache do + assert_queries(2) do + Post.in_batches {} + Post.in_batches {} + end + end + end + + test ".in_batches does not disable the query cache inside the given block" do + Post.cache do + Post.in_batches(start: 1, finish: 1) do |relation| + assert_queries(1) do + relation.count + relation.count + end + end + end + end end diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index 80baaac30a..7d6dc21e34 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -817,4 +817,46 @@ class CalculationsTest < ActiveRecord::TestCase assert_equal 6, Account.sum(:firm_id) { 1 } end end + + test "#skip_query_cache! for #pluck" do + Account.cache do + assert_queries(1) do + Account.pluck(:credit_limit) + Account.pluck(:credit_limit) + end + + assert_queries(2) do + Account.all.skip_query_cache!.pluck(:credit_limit) + Account.all.skip_query_cache!.pluck(:credit_limit) + end + end + end + + test "#skip_query_cache! for a simple calculation" do + Account.cache do + assert_queries(1) do + Account.calculate(:sum, :credit_limit) + Account.calculate(:sum, :credit_limit) + end + + assert_queries(2) do + Account.all.skip_query_cache!.calculate(:sum, :credit_limit) + Account.all.skip_query_cache!.calculate(:sum, :credit_limit) + end + end + end + + test "#skip_query_cache! for a grouped calculation" do + Account.cache do + assert_queries(1) do + Account.group(:firm_id).calculate(:sum, :credit_limit) + Account.group(:firm_id).calculate(:sum, :credit_limit) + end + + assert_queries(2) do + Account.all.skip_query_cache!.group(:firm_id).calculate(:sum, :credit_limit) + Account.all.skip_query_cache!.group(:firm_id).calculate(:sum, :credit_limit) + end + end + end end diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index 420f552ef6..af21cd529f 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -1232,6 +1232,34 @@ class FinderTest < ActiveRecord::TestCase assert_equal tyre2, zyke.tyres.custom_find_by(id: tyre2.id) end + test "#skip_query_cache! for #exists?" do + Topic.cache do + assert_queries(1) do + Topic.exists? + Topic.exists? + end + + assert_queries(2) do + Topic.all.skip_query_cache!.exists? + Topic.all.skip_query_cache!.exists? + end + end + end + + test "#skip_query_cache! for #exists? with a limited eager load" do + Topic.cache do + assert_queries(2) do + Topic.eager_load(:replies).limit(1).exists? + Topic.eager_load(:replies).limit(1).exists? + end + + assert_queries(4) do + Topic.eager_load(:replies).limit(1).skip_query_cache!.exists? + Topic.eager_load(:replies).limit(1).skip_query_cache!.exists? + end + end + end + private def table_with_custom_primary_key yield(Class.new(Toy) do diff --git a/activerecord/test/cases/relation/mutation_test.rb b/activerecord/test/cases/relation/mutation_test.rb index dea787c07f..8e73baa70a 100644 --- a/activerecord/test/cases/relation/mutation_test.rb +++ b/activerecord/test/cases/relation/mutation_test.rb @@ -90,7 +90,7 @@ module ActiveRecord assert_equal [], relation.extending_values end - (Relation::SINGLE_VALUE_METHODS - [:lock, :reordering, :reverse_order, :create_with]).each do |method| + (Relation::SINGLE_VALUE_METHODS - [:lock, :reordering, :reverse_order, :create_with, :skip_query_cache]).each do |method| test "##{method}!" do assert relation.public_send("#{method}!", :foo).equal?(relation) assert_equal :foo, relation.public_send("#{method}_value") @@ -162,5 +162,10 @@ module ActiveRecord relation.distinct! :foo assert_equal :foo, relation.distinct_value end + + test "skip_query_cache!" do + relation.skip_query_cache! + assert relation.skip_query_cache_value + end end end diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 5767dec315..eb3449b331 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -2034,4 +2034,46 @@ class RelationTest < ActiveRecord::TestCase assert_equal 2, posts.to_a.length end + + test "#skip_query_cache!" do + Post.cache do + assert_queries(1) do + Post.all.load + Post.all.load + end + + assert_queries(2) do + Post.all.skip_query_cache!.load + Post.all.skip_query_cache!.load + end + end + end + + test "#skip_query_cache! with an eager load" do + Post.cache do + assert_queries(1) do + Post.eager_load(:comments).load + Post.eager_load(:comments).load + end + + assert_queries(2) do + Post.eager_load(:comments).skip_query_cache!.load + Post.eager_load(:comments).skip_query_cache!.load + end + end + end + + test "#skip_query_cache! with a preload" do + Post.cache do + assert_queries(2) do + Post.preload(:comments).load + Post.preload(:comments).load + end + + assert_queries(4) do + Post.preload(:comments).skip_query_cache!.load + Post.preload(:comments).skip_query_cache!.load + end + end + end end -- cgit v1.2.3 From 6b7347b124064bbbaf3a20eadee7fbec977eed4c Mon Sep 17 00:00:00 2001 From: Dennis Taylor Date: Thu, 6 Jul 2017 10:33:36 -0700 Subject: Use StandardError instead of RuntimeError. Whoops. --- activerecord/test/cases/adapter_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb index 2236039ff7..3827e87d35 100644 --- a/activerecord/test/cases/adapter_test.rb +++ b/activerecord/test/cases/adapter_test.rb @@ -212,9 +212,9 @@ module ActiveRecord end def test_exceptions_from_notifications_are_not_translated - original_error = RuntimeError.new("This RuntimeError shouldn't get translated") + original_error = StandardError.new("This StandardError shouldn't get translated") subscriber = ActiveSupport::Notifications.subscribe("sql.active_record") { raise original_error } - actual_error = assert_raises(RuntimeError) do + actual_error = assert_raises(StandardError) do @connection.execute("SELECT * FROM posts") end -- cgit v1.2.3 From b3f3d49fd6b91c6573b3e10e3d00f65306638927 Mon Sep 17 00:00:00 2001 From: Kir Shatrov Date: Sat, 1 Jul 2017 23:09:13 +0300 Subject: Prepare AP and AR to be frozen string friendly --- .../lib/active_record/connection_adapters/postgresql/oid/money.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb index 7a91272d1c..cd7442e751 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActiveRecord module ConnectionAdapters module PostgreSQL @@ -22,7 +23,7 @@ module ActiveRecord # (3) -$2.55 # (4) ($2.55) - value.sub!(/^\((.+)\)$/, '-\1') # (4) + value = value.sub(/^\((.+)\)$/, '-\1') # (4) case value when /^-?\D+[\d,]+\.\d{2}$/ # (1) value.gsub!(/[^-\d.]/, "") -- cgit v1.2.3 From 3b1caef68f1780672f2e195d93209de40254bc11 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Fri, 7 Jul 2017 07:03:42 +0900 Subject: Fix extracting MariaDB version Currently `version` method always returns `5.5.5` because the `full_version` is `5.5.5-10.x.y-MariaDB...` since MariaDB 10.x. It should be ignored if the prefix is `5.5.5-`. --- .../active_record/connection_adapters/abstract_mysql_adapter.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index c15b4a1a05..06976aa769 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -59,12 +59,12 @@ module ActiveRecord @statements = StatementPool.new(self.class.type_cast_config_to_integer(config[:statement_limit])) if version < "5.1.10" - raise "Your version of MySQL (#{full_version.match(/^\d+\.\d+\.\d+/)[0]}) is too old. Active Record supports MySQL >= 5.1.10." + raise "Your version of MySQL (#{version_string}) is too old. Active Record supports MySQL >= 5.1.10." end end def version #:nodoc: - @version ||= Version.new(full_version.match(/^\d+\.\d+\.\d+/)[0]) + @version ||= Version.new(version_string) end def mariadb? # :nodoc: @@ -854,6 +854,10 @@ module ActiveRecord end end + def version_string + full_version.match(/^(?:5\.5\.5-)?(\d+\.\d+\.\d+)/)[1] + end + class MysqlString < Type::String # :nodoc: def serialize(value) case value -- cgit v1.2.3 From dff37ff613d12201c2b770dbc61b125792c7bb6e Mon Sep 17 00:00:00 2001 From: Eugene Kenny Date: Fri, 7 Jul 2017 00:53:02 +0100 Subject: Rename raw_write_attribute to write_attribute_without_type_cast This name more accurately describes what the method does, and also disambiguates it from `_write_attribute`, which ignores aliases. We can also make the method private, since it's not public API and only called from one place - `update_columns` - without an explicit receiver. --- activerecord/lib/active_record/attribute_methods/dirty.rb | 2 +- activerecord/lib/active_record/attribute_methods/write.rb | 12 ++++++------ activerecord/lib/active_record/persistence.rb | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb index 76987fb8f4..7bf5c7485f 100644 --- a/activerecord/lib/active_record/attribute_methods/dirty.rb +++ b/activerecord/lib/active_record/attribute_methods/dirty.rb @@ -80,7 +80,7 @@ module ActiveRecord clear_mutation_trackers end - def raw_write_attribute(attr_name, *) + def write_attribute_without_type_cast(attr_name, *) result = super clear_attribute_change(attr_name) result diff --git a/activerecord/lib/active_record/attribute_methods/write.rb b/activerecord/lib/active_record/attribute_methods/write.rb index d7ddd35dff..54b673c72e 100644 --- a/activerecord/lib/active_record/attribute_methods/write.rb +++ b/activerecord/lib/active_record/attribute_methods/write.rb @@ -39,12 +39,6 @@ module ActiveRecord _write_attribute(name, value) end - def raw_write_attribute(attr_name, value) # :nodoc: - name = attr_name.to_s - @attributes.write_cast_value(name, value) - value - end - # This method exists to avoid the expensive primary_key check internally, without # breaking compatibility with the write_attribute API def _write_attribute(attr_name, value) # :nodoc: @@ -53,6 +47,12 @@ module ActiveRecord end private + def write_attribute_without_type_cast(attr_name, value) + name = attr_name.to_s + @attributes.write_cast_value(name, value) + value + end + # Handle *= for method_missing. def attribute=(attribute_name, value) _write_attribute(attribute_name, value) diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index f652c7c3a1..669c838405 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -333,7 +333,7 @@ module ActiveRecord updated_count = self.class.unscoped.where(self.class.primary_key => id).update_all(attributes) attributes.each do |k, v| - raw_write_attribute(k, v) + write_attribute_without_type_cast(k, v) end updated_count == 1 -- cgit v1.2.3 From f4e2807a1a72873af5630fa19888ea5bd61aaafa Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Fri, 7 Jul 2017 09:32:01 +0900 Subject: Use `information_schema` to extract `generation_expression` for MariaDB Since MariaDB 10.2.5, `information_schema` supports Virtual Columns. Fixes #29670. --- .../lib/active_record/connection_adapters/mysql/schema_dumper.rb | 2 +- activerecord/test/cases/adapters/mysql2/virtual_column_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb index eff96e329f..a46d9f8cbb 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb @@ -53,7 +53,7 @@ module ActiveRecord end def extract_expression_for_virtual_column(column) - if mariadb? + if mariadb? && version < "10.2.5" create_table_info = create_table_info(column.table_name) if %r/#{quote_column_name(column.name)} #{Regexp.quote(column.sql_type)}(?: COLLATE \w+)? AS \((?.+?)\) #{column.extra}/ =~ create_table_info $~[:expression].inspect diff --git a/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb b/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb index 442a4fb7b5..1c5ef2aa41 100644 --- a/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb +++ b/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb @@ -52,7 +52,7 @@ if ActiveRecord::Base.connection.supports_virtual_columns? def test_schema_dumping output = dump_table_schema("virtual_columns") - assert_match(/t\.virtual\s+"upper_name",\s+type: :string,\s+as: "UPPER\(`name`\)"$/i, output) + assert_match(/t\.virtual\s+"upper_name",\s+type: :string,\s+as: "(?:UPPER|UCASE)\(`name`\)"$/i, output) assert_match(/t\.virtual\s+"name_length",\s+type: :integer,\s+as: "LENGTH\(`name`\)",\s+stored: true$/i, output) end end -- cgit v1.2.3 From 80cbf27f9e435dbf663e7e517c64d7589f91cc49 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Fri, 7 Jul 2017 10:19:42 +0900 Subject: Fix default `CURRENT_TIMESTAMP` in schema dumping for MariaDB 10.2 Since MariaDB 10.2, `CURRENT_TIMESTAMP` is shown as a function (`current_timestamp()`). Fix matching column default to address that case. Fixes #29698. --- .../lib/active_record/connection_adapters/mysql/schema_statements.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb index a01fbba201..24f8ff6367 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb @@ -73,8 +73,8 @@ module ActiveRecord def new_column_from_field(table_name, field) type_metadata = fetch_type_metadata(field[:Type], field[:Extra]) - if type_metadata.type == :datetime && field[:Default] == "CURRENT_TIMESTAMP" - default, default_function = nil, field[:Default] + if type_metadata.type == :datetime && /\ACURRENT_TIMESTAMP(?:\(\))?\z/i.match?(field[:Default]) + default, default_function = nil, "CURRENT_TIMESTAMP" else default, default_function = field[:Default], nil end -- cgit v1.2.3 From e45226dd899ebb39d4ae0fae1dda4a2a507eaddd Mon Sep 17 00:00:00 2001 From: Dennis Taylor Date: Fri, 7 Jul 2017 11:27:46 -0700 Subject: Fix changelog wording as suggested. --- activerecord/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index b5457e389b..53b9752867 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,5 +1,5 @@ -* Prevent AbstractAdapter from converting exceptions from ActiveSupport::Notification - callbacks into ActiveRecord::StatementInvalids. +* Prevent errors raised by sql.active_record notification subscribers from being converted into + ActiveRecord::StatementInvalid exceptions. *Dennis Taylor* -- cgit v1.2.3 From 79c8fa7c643831d0f731937d1b7e082df2e82885 Mon Sep 17 00:00:00 2001 From: Dennis Taylor Date: Fri, 7 Jul 2017 11:28:17 -0700 Subject: Rename the StatementInvalid test method for clarity. --- activerecord/test/cases/adapter_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb index 3827e87d35..5ec15aff06 100644 --- a/activerecord/test/cases/adapter_test.rb +++ b/activerecord/test/cases/adapter_test.rb @@ -224,7 +224,7 @@ module ActiveRecord ActiveSupport::Notifications.unsubscribe(subscriber) if subscriber end - def test_other_exceptions_are_translated_to_statement_invalid + def test_database_related_exceptions_are_translated_to_statement_invalid error = assert_raises(ActiveRecord::StatementInvalid) do @connection.execute("This is a syntax error") end -- cgit v1.2.3 From 8219e177633e3c3a77a50c2342b8fe6c4956914b Mon Sep 17 00:00:00 2001 From: Dennis Taylor Date: Fri, 7 Jul 2017 11:28:47 -0700 Subject: Remove driver-specific hard-coding in the tests. --- activerecord/test/cases/adapter_test.rb | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb index 5ec15aff06..827bcba121 100644 --- a/activerecord/test/cases/adapter_test.rb +++ b/activerecord/test/cases/adapter_test.rb @@ -230,7 +230,7 @@ module ActiveRecord end assert_instance_of ActiveRecord::StatementInvalid, error - assert_instance_of syntax_error_exception_class, error.cause + assert_kind_of Exception, error.cause end def test_select_all_always_return_activerecord_result @@ -283,14 +283,6 @@ module ActiveRecord assert_not_nil error.message end end - - private - - def syntax_error_exception_class - return Mysql2::Error if defined?(Mysql2) - return PG::SyntaxError if defined?(PG) - return SQLite3::SQLException if defined?(SQLite3) - end end class AdapterForeignKeyTest < ActiveRecord::TestCase -- cgit v1.2.3 From 38b041713b609d8fcd2c458804cdef8a81e567a7 Mon Sep 17 00:00:00 2001 From: pdebelak Date: Fri, 7 Jul 2017 16:19:56 -0500 Subject: Don't allow uuids with orphan curly braces The uuid validation regex was allowing uuids to have a single leading curly brace or single trailing curly brace. Saving with such a uuid would cause Postgres to generate an exception even though the record seemed valid. With this change, the regex requires both a leading *and* a trailing curly brace or neither to be valid. --- .../lib/active_record/connection_adapters/postgresql/oid/uuid.rb | 2 +- activerecord/test/cases/adapters/postgresql/uuid_test.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb index 5e839228e9..db92333ef7 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb @@ -3,7 +3,7 @@ module ActiveRecord module PostgreSQL module OID # :nodoc: class Uuid < Type::Value # :nodoc: - ACCEPTABLE_UUID = %r{\A\{?([a-fA-F0-9]{4}-?){8}\}?\z}x + ACCEPTABLE_UUID = %r{\A(\{)?([a-fA-F0-9]{4}-?){8}(?(1)\}|)\z} alias_method :serialize, :deserialize diff --git a/activerecord/test/cases/adapters/postgresql/uuid_test.rb b/activerecord/test/cases/adapters/postgresql/uuid_test.rb index 8eddd81c38..00de92cdfd 100644 --- a/activerecord/test/cases/adapters/postgresql/uuid_test.rb +++ b/activerecord/test/cases/adapters/postgresql/uuid_test.rb @@ -124,7 +124,9 @@ class PostgresqlUUIDTest < ActiveRecord::PostgreSQLTestCase "Z0000C99-9C0B-4EF8-BB6D-6BB9BD380A11", "a0eebc999r0b4ef8ab6d6bb9bd380a11", "a0ee-bc99------4ef8-bb6d-6bb9-bd38-0a11", - "{a0eebc99-bb6d6bb9-bd380a11}"].each do |invalid_uuid| + "{a0eebc99-bb6d6bb9-bd380a11}", + "{a0eebc99-9c0b4ef8-bb6d6bb9-bd380a11", + "a0eebc99-9c0b4ef8-bb6d6bb9-bd380a11}"].each do |invalid_uuid| uuid = UUIDType.new guid: invalid_uuid assert_nil uuid.guid end -- cgit v1.2.3 From 72e1c4229ab0af6a76c1635adff76fc02fa7fe71 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 9 Jul 2017 04:15:53 +0900 Subject: Add backticks [ci skip] --- activerecord/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 5b88722993..786bef7359 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -6,8 +6,8 @@ *Eugene Kenny* -* Prevent errors raised by sql.active_record notification subscribers from being converted into - ActiveRecord::StatementInvalid exceptions. +* Prevent errors raised by `sql.active_record` notification subscribers from being converted into + `ActiveRecord::StatementInvalid` exceptions. *Dennis Taylor* -- cgit v1.2.3