aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-12-11 20:22:57 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-12-11 20:22:57 -0200
commit683df716f3261121af4f8e3e03cc1ce70782ac30 (patch)
tree6eda1a84eb34ba89f1555fb7d1d3d282ecdd0882 /activerecord/lib
parent7a036ebd30a6333f22684bdd33dcf5ad4d101d26 (diff)
downloadrails-683df716f3261121af4f8e3e03cc1ce70782ac30.tar.gz
rails-683df716f3261121af4f8e3e03cc1ce70782ac30.tar.bz2
rails-683df716f3261121af4f8e3e03cc1ce70782ac30.zip
Move the parameter normalization to the initialize method
activerecord-deprecated_finders expects the parameters denormalized in its initialize method
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/builder/association.rb9
1 files 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