aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-10-08 23:59:44 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-10-08 23:59:44 -0300
commit23517aa9a4125c9060562b87281515826e2d66cb (patch)
tree68ec6a8fc9c60e55ad5714c769c526a83e7d8dc2 /activerecord
parentd300256ca4dd8b6f921afe8ef2de05d7e9c084e7 (diff)
downloadrails-23517aa9a4125c9060562b87281515826e2d66cb.tar.gz
rails-23517aa9a4125c9060562b87281515826e2d66cb.tar.bz2
rails-23517aa9a4125c9060562b87281515826e2d66cb.zip
Push define_accessors to class level since we don't need anythig from
the instance
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/builder/association.rb8
-rw-r--r--activerecord/lib/active_record/associations/builder/belongs_to.rb4
-rw-r--r--activerecord/lib/active_record/associations/builder/singular_association.rb4
3 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/associations/builder/association.rb b/activerecord/lib/active_record/associations/builder/association.rb
index fa46ea060e..fe8274e1d8 100644
--- a/activerecord/lib/active_record/associations/builder/association.rb
+++ b/activerecord/lib/active_record/associations/builder/association.rb
@@ -23,7 +23,7 @@ module ActiveRecord::Associations::Builder
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 @@ module ActiveRecord::Associations::Builder
# 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)
diff --git a/activerecord/lib/active_record/associations/builder/belongs_to.rb b/activerecord/lib/active_record/associations/builder/belongs_to.rb
index 8279fcdaa6..c0b1847f33 100644
--- a/activerecord/lib/active_record/associations/builder/belongs_to.rb
+++ b/activerecord/lib/active_record/associations/builder/belongs_to.rb
@@ -18,9 +18,9 @@ module ActiveRecord::Associations::Builder
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
diff --git a/activerecord/lib/active_record/associations/builder/singular_association.rb b/activerecord/lib/active_record/associations/builder/singular_association.rb
index 4dc45d4d25..8e6bd7fcc6 100644
--- a/activerecord/lib/active_record/associations/builder/singular_association.rb
+++ b/activerecord/lib/active_record/associations/builder/singular_association.rb
@@ -6,9 +6,9 @@ module ActiveRecord::Associations::Builder
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