Permalink
Browse files

Push define_accessors to class level since we don't need anythig from

the instance
  • Loading branch information...
1 parent d300256 commit 23517aa9a4125c9060562b87281515826e2d66cb @rafaelfranca rafaelfranca committed Oct 9, 2013
@@ -23,7 +23,7 @@ class << self
def self.build(model, name, scope, options, &block)
builder = create_builder model, name, scope, options, &block
reflection = builder.build(model)
- builder.define_accessors model, reflection
+ define_accessors model, reflection
define_callbacks model, reflection
builder.define_extensions model
reflection
@@ -84,11 +84,11 @@ def self.define_callbacks(model, reflection)
# end
#
# Post.first.comments and Post.first.comments= methods are defined by this method...
- def define_accessors(model, reflection)
+ def self.define_accessors(model, reflection)
mixin = model.generated_feature_methods
name = reflection.name
- self.class.define_readers(mixin, name)
- self.class.define_writers(mixin, name)
+ define_readers(mixin, name)
+ define_writers(mixin, name)
end
def self.define_readers(mixin, name)
@@ -18,9 +18,9 @@ def self.define_callbacks(model, reflection)
add_touch_callbacks(model, reflection) if reflection.options[:touch]
end
- def define_accessors(mixin, reflection)
+ def self.define_accessors(mixin, reflection)
super
- self.class.add_counter_cache_methods mixin
+ add_counter_cache_methods mixin
end
private
@@ -6,9 +6,9 @@ def valid_options
super + [:remote, :dependent, :counter_cache, :primary_key, :inverse_of]
end
- def define_accessors(model, reflection)
+ def self.define_accessors(model, reflection)
super
- self.class.define_constructors(model.generated_feature_methods, reflection.name) if reflection.constructable?
+ define_constructors(model.generated_feature_methods, reflection.name) if reflection.constructable?
end
# Defines the (build|create)_association methods for belongs_to or has_one association

0 comments on commit 23517aa

Please sign in to comment.