Permalink
Browse files

push more mutations outside the factory method

  • Loading branch information...
1 parent 71aba97 commit 86588f9bc4d6214a8e625f97fcadb246592c41c0 @tenderlove tenderlove committed Aug 1, 2013
@@ -29,6 +29,7 @@ def self.build(model, name, scope, options, &block)
reflection = builder.build
builder.define_accessors model.generated_feature_methods
builder.define_callbacks model, reflection
+ builder.define_extensions model
reflection
end
@@ -68,6 +69,9 @@ def validate_options
options.assert_valid_keys(valid_options)
end
+ def define_extensions(model)
+ end
+
def define_callbacks(model, reflection)
add_before_destroy_callbacks(model, name) if options[:dependent]
Association.extensions.each do |extension|
@@ -14,21 +14,15 @@ def valid_options
attr_reader :block_extension
- def initialize(*args)
- super(*args)
+ def initialize(model, name, scope, options)
+ super
@mod = nil
if block_given?
@mod = Module.new(&Proc.new)
@scope = wrap_scope @scope, @mod
end
end
- def build
- define_extensions(model)
- reflection = super
- reflection
- end
-
def define_callbacks(model, reflection)
super
CALLBACKS.each { |callback_name| define_callback(model, callback_name) }

0 comments on commit 86588f9

Please sign in to comment.