From b9d6759401c3d50a51e0a7650cb2331f4218d11f Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Fri, 28 Jun 2024 18:32:42 +0200 Subject: [PATCH] Style pass over active_record/associations/builder/association.rb I was reading this source code and made a few edits on passing to ensure style details agree within the file itself and Rails. The addition of "# noop" makes the method body look similar to other analogous ones in the same file (not shown in the diff). --- .../associations/builder/association.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/activerecord/lib/active_record/associations/builder/association.rb b/activerecord/lib/active_record/associations/builder/association.rb index b785772d8be24..0f80a2e81a10e 100644 --- a/activerecord/lib/active_record/associations/builder/association.rb +++ b/activerecord/lib/active_record/associations/builder/association.rb @@ -30,10 +30,10 @@ def self.build(model, name, scope, options, &block) end reflection = create_reflection(model, name, scope, options, &block) - define_accessors model, reflection - define_callbacks model, reflection - define_validations model, reflection - define_change_tracking_methods model, reflection + define_accessors(model, reflection) + define_callbacks(model, reflection) + define_validations(model, reflection) + define_change_tracking_methods(model, reflection) reflection end @@ -71,6 +71,7 @@ def self.validate_options(options) end def self.define_extensions(model, name) + # noop end def self.define_callbacks(model, reflection) @@ -81,7 +82,7 @@ def self.define_callbacks(model, reflection) end Association.extensions.each do |extension| - extension.build model, reflection + extension.build(model, reflection) end end @@ -131,7 +132,7 @@ def self.check_dependent_options(dependent, model) err_message = "A valid destroy_association_async_job is required to use `dependent: :destroy_async` on associations" raise ActiveRecord::ConfigurationError, err_message end - unless valid_dependent_options.include? dependent + unless valid_dependent_options.include?(dependent) raise ArgumentError, "The :dependent option must be one of #{valid_dependent_options}, but is :#{dependent}" end end