Skip to content

Commit

Permalink
Style pass over active_record/associations/builder/association.rb
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
fxn committed Jun 28, 2024
1 parent f0f624b commit b9d6759
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -71,6 +71,7 @@ def self.validate_options(options)
end

def self.define_extensions(model, name)
# noop
end

def self.define_callbacks(model, reflection)
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b9d6759

Please sign in to comment.