diff options
Diffstat (limited to 'activerecord/lib/active_record/associations/belongs_to_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/belongs_to_association.rb | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/associations/belongs_to_association.rb b/activerecord/lib/active_record/associations/belongs_to_association.rb index 63eb38ab34..c54e397ae4 100644 --- a/activerecord/lib/active_record/associations/belongs_to_association.rb +++ b/activerecord/lib/active_record/associations/belongs_to_association.rb @@ -29,17 +29,6 @@ module ActiveRecord @updated end - def stale_target? - if @target && @target.persisted? - target_id = @target[@reflection.association_primary_key].to_s - foreign_key = @owner[@reflection.foreign_key].to_s - - target_id != foreign_key - else - false - end - end - private def update_counters(record) counter_cache_name = @reflection.counter_cache_column @@ -106,6 +95,10 @@ module ActiveRecord @owner[@reflection.foreign_key] end end + + def stale_state + @owner[@reflection.foreign_key].to_s + end end end end |