Browse files

Move define_writers to class level since we don't need anything from the

instance
  • Loading branch information...
1 parent 154c606 commit 6157f742951e168bf0adbaf82ea80e8497186ca8 @rafaelfranca rafaelfranca committed Oct 9, 2013
View
4 activerecord/lib/active_record/associations/builder/association.rb
@@ -87,7 +87,7 @@ def self.define_callbacks(model, reflection)
def define_accessors(model, reflection)
mixin = model.generated_feature_methods
self.class.define_readers(mixin, name)
- define_writers(mixin)
+ self.class.define_writers(mixin, name)
end
def self.define_readers(mixin, name)
@@ -98,7 +98,7 @@ def #{name}(*args)
CODE
end
- def define_writers(mixin)
+ def self.define_writers(mixin, name)
mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1
def #{name}=(value)
association(:#{name}).writer(value)
View
2 activerecord/lib/active_record/associations/builder/collection_association.rb
@@ -68,7 +68,7 @@ def #{name.to_s.singularize}_ids
CODE
end
- def define_writers(mixin)
+ def self.define_writers(mixin, name)
super
mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1

0 comments on commit 6157f74

Please sign in to comment.