diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-02 15:10:43 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-02 15:28:50 -0700 |
commit | ea11af9568744a665f8ddc8f0cdca7407cc51d2b (patch) | |
tree | 98dd29e68477a0a816581903413590f2320fcd28 /activerecord/lib/active_record | |
parent | 743f1a9094c0b6f7b47a9dad211a6b2b77bdb85a (diff) | |
download | rails-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')
-rw-r--r-- | activerecord/lib/active_record/associations/builder/belongs_to.rb | 8 |
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) |