Sha256: 47f5c1324adbea589f97efc7e43644dc75fbedac188699accbac31c5dcc610d4
Contents?: true
Size: 606 Bytes
Versions: 5
Compression:
Stored size: 606 Bytes
Contents
module FeatureGate class GatedFeature < ActiveRecord::Base validates :name, presence: true validates :gated, inclusion: { in: [true, false] } scope :opened, -> { where(gated: false) } scope :closed, -> { where(gated: true) } scope :stale, -> { where('updated_at != created_at and updated_at < ?', Time.zone.now - FeatureGate.time_to_stale) } def deploy_feature! self.gated = false save! end def gate_feature! self.gated = true save! end def status if gated 'closed' else 'opened' end end end end
Version data entries
5 entries across 5 versions & 1 rubygems