lib/active_regulation/containment.rb in active_regulation-2.2.3 vs lib/active_regulation/containment.rb in active_regulation-2.2.4
- old
+ new
@@ -1,13 +1,14 @@
module ActiveRegulation
module Containment
extend ActiveSupport::Concern
+ include ActiveRegulation::Base
included do
attr_accessor :containment, :raw_containment
- before_save :record_containment!, unless: -> (obj) { obj.raw_containment.nil? }
+ before_save :record_containment!, unless: -> (obj) { obj.raw_containment.nil? }
after_initialize :set_containment!
scope :contained, -> { where.not(contained_at: nil) }
scope :uncontained, -> { where(contained_at: nil) }
end
@@ -33,11 +34,11 @@
end
private
def record_containment!
- false_value = ActiveRecord::ConnectionAdapters::Column::FALSE_VALUES.include?(containment)
- true_value = ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES.include?(containment)
+ false_value = FALSE_VALUES.include?(containment)
+ true_value = TRUE_VALUES.include?(containment)
if false_value || true_value
self.contained_at = (false_value ? nil : Time.now)
else
raise ArgumentError,
\ No newline at end of file