lib/active_regulation/visibility.rb in active_regulation-2.4.0 vs lib/active_regulation/visibility.rb in active_regulation-3.0.0
- old
+ new
@@ -1,20 +1,20 @@
module ActiveRegulation
module Visibility
extend ActiveSupport::Concern
included do
- scope :visible, -> { where(invisible_at: nil) }
+ scope :visible, -> { where(invisible_at: nil) }
scope :invisible, -> { where.not(invisible_at: nil) }
end
def invisible!
- update(invisible_at: Time.now)
+ update(invisible_at: Time.now) if visible?
end
def visible!
- update(invisible_at: nil)
+ update(invisible_at: nil) if invisible?
end
def invisible?
!visible?
end
@@ -30,6 +30,6 @@
def to_visibility
I18n.t("active_regulation.visibility.#{visible? ? :visible : :invisible}")
end
end
-end
\ No newline at end of file
+end