Permalink
Browse files

Move define_constructors to class level

  • Loading branch information...
rafaelfranca committed Oct 9, 2013
1 parent 6157f74 commit bfa82499d633d586020af2333e68b2d85df190b2
Showing with 2 additions and 3 deletions.
  1. +2 −3 activerecord/lib/active_record/associations/builder/singular_association.rb
@@ -8,12 +8,11 @@ def valid_options
def define_accessors(model, reflection)
super
- define_constructors(model.generated_feature_methods) if reflection.constructable?
+ self.class.define_constructors(model.generated_feature_methods, name) if reflection.constructable?
end
# Defines the (build|create)_association methods for belongs_to or has_one association
-
- def define_constructors(mixin)
+ def self.define_constructors(mixin, name)
mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1
def build_#{name}(*args, &block)
association(:#{name}).build(*args, &block)

0 comments on commit bfa8249

Please sign in to comment.