Class: Stance::EventRecord
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Stance::EventRecord
- Defined in:
- app/models/stance/event_record.rb
Class Method Summary collapse
Instance Method Summary collapse
- #active? ⇒ Boolean
- #dismiss ⇒ Object
- #dismissed? ⇒ Boolean
- #event_class ⇒ Object
- #event_class_name ⇒ Object
- #to_s ⇒ Object
Class Method Details
.dismiss_all ⇒ Object
30 31 32 |
# File 'app/models/stance/event_record.rb', line 30 def self.dismiss_all active.each(&:dismiss) end |
.table_name_prefix ⇒ Object
26 27 28 |
# File 'app/models/stance/event_record.rb', line 26 def self.table_name_prefix 'stance_' end |
Instance Method Details
#active? ⇒ Boolean
50 51 52 |
# File 'app/models/stance/event_record.rb', line 50 def active? !dismissed? end |
#dismiss ⇒ Object
54 55 56 |
# File 'app/models/stance/event_record.rb', line 54 def dismiss update_attribute :dismissed_at, Time.current end |
#dismissed? ⇒ Boolean
46 47 48 |
# File 'app/models/stance/event_record.rb', line 46 def dismissed? dismissed_at.present? end |
#event_class ⇒ Object
42 43 44 |
# File 'app/models/stance/event_record.rb', line 42 def event_class @event_class ||= event_class_name.constantize end |
#event_class_name ⇒ Object
38 39 40 |
# File 'app/models/stance/event_record.rb', line 38 def event_class_name @event_class_name ||= "#{subject_type}Events::#{name.tr('.', '/').classify}" end |
#to_s ⇒ Object
34 35 36 |
# File 'app/models/stance/event_record.rb', line 34 def to_s name end |