Sha256: 7aba97c8043fb95e00e731a8405867d029778f194e05699242838e965000a5d2
Contents?: true
Size: 457 Bytes
Versions: 12
Compression:
Stored size: 457 Bytes
Contents
module Detour::Concerns module CountableFlag extend ActiveSupport::Concern included do after_save :step_count after_destroy :step_count private def step_count count = feature.send("#{flag_type}_count_for", flaggable_type.tableize) count = destroyed? ? count - 1 : count + 1 feature.send("#{flag_type}_counts")[flaggable_type.tableize] = count feature.save! end end end end
Version data entries
12 entries across 12 versions & 1 rubygems