Flowdock
method

destroy_row

Importance_0
v4.2.1 - Show latest stable - 0 notes - Class: ActiveRecord::CounterCache
destroy_row() private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/counter_cache.rb, line 151
      def destroy_row
        affected_rows = super

        if affected_rows > 0
          each_counter_cached_associations do |association|
            foreign_key = association.reflection.foreign_key.to_sym
            unless destroyed_by_association && destroyed_by_association.foreign_key.to_sym == foreign_key
              if send(association.reflection.name)
                association.decrement_counters
              end
            end
          end
        end

        affected_rows
      end
Register or log in to add new notes.