Module: SharedBehaviour::Deprecatable
- Included in:
- Product, ProductCriteria
- Defined in:
- app/models/shared_behaviour/deprecatable.rb
Class Method Summary collapse
Instance Method Summary collapse
- #deprecate! ⇒ Object
-
#deprecated? ⇒ Boolean
If we have a datestamp we are deprecated.
Class Method Details
.included(base) ⇒ Object
3 4 5 |
# File 'app/models/shared_behaviour/deprecatable.rb', line 3 def self.included(base) base.class_eval { scope :active, -> { where(deprecated_at: nil) } } end |
Instance Method Details
#deprecate! ⇒ Object
7 8 9 10 |
# File 'app/models/shared_behaviour/deprecatable.rb', line 7 def deprecate! self.deprecated_at = DateTime.now save! end |
#deprecated? ⇒ Boolean
If we have a datestamp we are deprecated
13 14 15 |
# File 'app/models/shared_behaviour/deprecatable.rb', line 13 def deprecated? deprecated_at? end |