aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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