aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-10-02 15:19:33 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-10-02 15:28:50 -0700
commit73ee85f39dadb35e61269ab0f6bd23503268c37d (patch)
treef06d530dce673b371d063b955545244495eedff4 /activerecord/lib/active_record
parent07d522b1bee0cec428c332ac8b7099a737f7ea35 (diff)
downloadrails-73ee85f39dadb35e61269ab0f6bd23503268c37d.tar.gz
rails-73ee85f39dadb35e61269ab0f6bd23503268c37d.tar.bz2
rails-73ee85f39dadb35e61269ab0f6bd23503268c37d.zip
push methods that don't depend on the instance to the class
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations/builder/belongs_to.rb8
-rw-r--r--activerecord/lib/active_record/associations/builder/collection_association.rb4
2 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/associations/builder/belongs_to.rb b/activerecord/lib/active_record/associations/builder/belongs_to.rb
index 8d7ede1dbe..6d590c8220 100644
--- a/activerecord/lib/active_record/associations/builder/belongs_to.rb
+++ b/activerecord/lib/active_record/associations/builder/belongs_to.rb
@@ -14,8 +14,8 @@ module ActiveRecord::Associations::Builder
def define_callbacks(model, reflection)
super
- add_counter_cache_callbacks(model, reflection) if reflection.options[:counter_cache]
- add_touch_callbacks(model, reflection) if reflection.options[:touch]
+ self.class.add_counter_cache_callbacks(model, reflection) if reflection.options[:counter_cache]
+ self.class.add_touch_callbacks(model, reflection) if reflection.options[:touch]
end
def define_accessors(mixin, reflection)
@@ -70,7 +70,7 @@ module ActiveRecord::Associations::Builder
end
end
- def add_counter_cache_callbacks(model, reflection)
+ def self.add_counter_cache_callbacks(model, reflection)
cache_column = reflection.counter_cache_column
model.after_create lambda { |record|
@@ -115,7 +115,7 @@ module ActiveRecord::Associations::Builder
end
end
- def add_touch_callbacks(model, reflection)
+ def self.add_touch_callbacks(model, reflection)
foreign_key = reflection.foreign_key
n = reflection.name
touch = reflection.options[:touch]
diff --git a/activerecord/lib/active_record/associations/builder/collection_association.rb b/activerecord/lib/active_record/associations/builder/collection_association.rb
index d640446a6d..68f60a76b0 100644
--- a/activerecord/lib/active_record/associations/builder/collection_association.rb
+++ b/activerecord/lib/active_record/associations/builder/collection_association.rb
@@ -28,7 +28,7 @@ module ActiveRecord::Associations::Builder
name = reflection.name
options = reflection.options
CALLBACKS.each { |callback_name|
- define_callback(model, callback_name, name, options)
+ self.class.define_callback(model, callback_name, name, options)
}
end
@@ -39,7 +39,7 @@ module ActiveRecord::Associations::Builder
end
end
- def define_callback(model, callback_name, name, options)
+ def self.define_callback(model, callback_name, name, options)
full_callback_name = "#{callback_name}_for_#{name}"
# TODO : why do i need method_defined? I think its because of the inheritance chain