Skip to content

Commit 683df71

Browse files
committed
Move the parameter normalization to the initialize method
activerecord-deprecated_finders expects the parameters denormalized in its initialize method
1 parent 7a036eb commit 683df71

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

activerecord/lib/active_record/associations/builder/association.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,16 @@ def self.build(model, name, scope, options, &block)
3737
def self.create_builder(model, name, scope, options, &block)
3838
raise ArgumentError, "association names must be a Symbol" unless name.kind_of?(Symbol)
3939

40+
new(model, name, scope, options, &block)
41+
end
42+
43+
def initialize(model, name, scope, options)
44+
# TODO: Move this to create_builder as soon we drop support to activerecord-deprecated_finders.
4045
if scope.is_a?(Hash)
4146
options = scope
4247
scope = nil
4348
end
4449

45-
new(model, name, scope, options, &block)
46-
end
47-
48-
def initialize(model, name, scope, options)
4950
# TODO: Remove this model argument as soon we drop support to activerecord-deprecated_finders.
5051
@name = name
5152
@scope = scope

0 commit comments

Comments
 (0)