From 683df716f3261121af4f8e3e03cc1ce70782ac30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Wed, 11 Dec 2013 20:22:57 -0200 Subject: Move the parameter normalization to the initialize method activerecord-deprecated_finders expects the parameters denormalized in its initialize method --- .../lib/active_record/associations/builder/association.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/activerecord/lib/active_record/associations/builder/association.rb b/activerecord/lib/active_record/associations/builder/association.rb index 3973570da4..3911d1b520 100644 --- a/activerecord/lib/active_record/associations/builder/association.rb +++ b/activerecord/lib/active_record/associations/builder/association.rb @@ -37,15 +37,16 @@ module ActiveRecord::Associations::Builder def self.create_builder(model, name, scope, options, &block) raise ArgumentError, "association names must be a Symbol" unless name.kind_of?(Symbol) + new(model, name, scope, options, &block) + end + + def initialize(model, name, scope, options) + # TODO: Move this to create_builder as soon we drop support to activerecord-deprecated_finders. if scope.is_a?(Hash) options = scope scope = nil end - new(model, name, scope, options, &block) - end - - def initialize(model, name, scope, options) # TODO: Remove this model argument as soon we drop support to activerecord-deprecated_finders. @name = name @scope = scope -- cgit v1.2.3