aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-10-02 15:10:43 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-10-02 15:28:50 -0700
commitea11af9568744a665f8ddc8f0cdca7407cc51d2b (patch)
tree98dd29e68477a0a816581903413590f2320fcd28 /activerecord/lib/active_record/associations
parent743f1a9094c0b6f7b47a9dad211a6b2b77bdb85a (diff)
downloadrails-ea11af9568744a665f8ddc8f0cdca7407cc51d2b.tar.gz
rails-ea11af9568744a665f8ddc8f0cdca7407cc51d2b.tar.bz2
rails-ea11af9568744a665f8ddc8f0cdca7407cc51d2b.zip
decouple belongs_to callback definition from the builder instance.
All the information is on the reflection, so just get it there.
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/builder/belongs_to.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/builder/belongs_to.rb b/activerecord/lib/active_record/associations/builder/belongs_to.rb
index 1d9492a3bd..8d7ede1dbe 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 options[:counter_cache]
- add_touch_callbacks(model, reflection) if options[:touch]
+ add_counter_cache_callbacks(model, reflection) if reflection.options[:counter_cache]
+ add_touch_callbacks(model, reflection) if reflection.options[:touch]
end
def define_accessors(mixin, reflection)
@@ -117,8 +117,8 @@ module ActiveRecord::Associations::Builder
def add_touch_callbacks(model, reflection)
foreign_key = reflection.foreign_key
- n = name
- touch = options[:touch]
+ n = reflection.name
+ touch = reflection.options[:touch]
callback = lambda { |record|
BelongsTo.touch_record(record, foreign_key, n, touch)