diff options
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/blog.rb | 7 |
1 files changed, 7 insertions, 0 deletions
| diff --git a/app/models/blog.rb b/app/models/blog.rb index 8599bcd..db05432 100644 --- a/app/models/blog.rb +++ b/app/models/blog.rb | |||
| @@ -19,6 +19,7 @@ class Blog < ApplicationRecord | |||
| 19 | 19 | ||
| 20 | before_validation :set_draft_title | 20 | before_validation :set_draft_title |
| 21 | before_save :set_published_at | 21 | before_save :set_published_at |
| 22 | after_save :send_webmentions | ||
| 22 | 23 | ||
| 23 | def path | 24 | def path |
| 24 | "/says/#{slug}" | 25 | "/says/#{slug}" |
| @@ -72,4 +73,10 @@ class Blog < ApplicationRecord | |||
| 72 | self.published_at = nil | 73 | self.published_at = nil |
| 73 | end | 74 | end |
| 74 | end | 75 | end |
| 76 | |||
| 77 | def send_webmentions | ||
| 78 | return unless self.published | ||
| 79 | |||
| 80 | SendWebmentionsJob.perform_later self | ||
| 81 | end | ||
| 75 | end | 82 | end |
