diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/blog.rb | 6 | ||||
-rw-r--r-- | app/models/stream.rb | 6 | ||||
-rw-r--r-- | app/models/update.rb | 4 |
3 files changed, 16 insertions, 0 deletions
diff --git a/app/models/blog.rb b/app/models/blog.rb index 5742879..18f63f1 100644 --- a/app/models/blog.rb +++ b/app/models/blog.rb | |||
@@ -1,6 +1,8 @@ | |||
1 | class Blog < ApplicationRecord | 1 | class Blog < ApplicationRecord |
2 | include Recordable | 2 | include Recordable |
3 | 3 | ||
4 | acts_as_taggable | ||
5 | |||
4 | validates :title, presence: true | 6 | validates :title, presence: true |
5 | validates :body, presence: true, if: :published | 7 | validates :body, presence: true, if: :published |
6 | validates :slug, presence: true, format: /\A[-a-z0-9]+\z/, if: :published | 8 | validates :slug, presence: true, format: /\A[-a-z0-9]+\z/, if: :published |
@@ -12,6 +14,10 @@ class Blog < ApplicationRecord | |||
12 | "/says/#{slug}" | 14 | "/says/#{slug}" |
13 | end | 15 | end |
14 | 16 | ||
17 | def taggable | ||
18 | self | ||
19 | end | ||
20 | |||
15 | private | 21 | private |
16 | def set_draft_title | 22 | def set_draft_title |
17 | if self.title.blank? and not self.published | 23 | if self.title.blank? and not self.published |
diff --git a/app/models/stream.rb b/app/models/stream.rb index 1398b75..0773143 100644 --- a/app/models/stream.rb +++ b/app/models/stream.rb | |||
@@ -1,6 +1,8 @@ | |||
1 | class Stream < ApplicationRecord | 1 | class Stream < ApplicationRecord |
2 | include Recordable | 2 | include Recordable |
3 | 3 | ||
4 | acts_as_taggable | ||
5 | |||
4 | has_many :updates | 6 | has_many :updates |
5 | 7 | ||
6 | validates :title, presence: true | 8 | validates :title, presence: true |
@@ -9,4 +11,8 @@ class Stream < ApplicationRecord | |||
9 | def path | 11 | def path |
10 | "/thinks/#{slug}" | 12 | "/thinks/#{slug}" |
11 | end | 13 | end |
14 | |||
15 | def taggable | ||
16 | self | ||
17 | end | ||
12 | end | 18 | end |
diff --git a/app/models/update.rb b/app/models/update.rb index 73c4911..01907d8 100644 --- a/app/models/update.rb +++ b/app/models/update.rb | |||
@@ -8,4 +8,8 @@ class Update < ApplicationRecord | |||
8 | def path | 8 | def path |
9 | "/thinks/#{stream.slug}\#update-#{id}" | 9 | "/thinks/#{stream.slug}\#update-#{id}" |
10 | end | 10 | end |
11 | |||
12 | def taggable | ||
13 | stream | ||
14 | end | ||
11 | end | 15 | end |