Class: Post
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Post
- Defined in:
- app/models/post.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
Instance Method Details
#published! ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'app/models/post.rb', line 28 def published! self.update(published_at: Time.now) super if self.user_id Notification.create(notify_type: 'press_published', user_id: self.user_id, target: self) end end |
#published_at ⇒ Object
24 25 26 |
# File 'app/models/post.rb', line 24 def published_at super || self.updated_at end |
#to_param ⇒ Object
16 17 18 |
# File 'app/models/post.rb', line 16 def to_param self.slug.blank? ? self.id : self.slug end |