method

counter_cache_target

rails latest stable - Class: ActiveRecord::Associations::Builder::BelongsTo

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v5.2.3) is shown here.

counter_cache_target(reflection, model, foreign_key)
public

No documentation available.

# File activerecord/lib/active_record/associations/builder/belongs_to.rb, line 64
          def counter_cache_target(reflection, model, foreign_key)
            primary_key = reflection.association_primary_key(model)
            model.unscoped.where!(primary_key => foreign_key)
          end