about summary refs log tree commit diff stats
path: root/app/models/blog.rb
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-07-07 16:23:04 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-07-07 16:23:04 -0400
commit42d9db526d3aef2e08848d6bc587feaf3700db42 (patch)
tree29bfcb6653bb6419fa087f87de72b00b00e68fd6 /app/models/blog.rb
parentdd231a335758873dcd9024db7618837094fcc0a5 (diff)
downloadthoughts-42d9db526d3aef2e08848d6bc587feaf3700db42.tar.gz
thoughts-42d9db526d3aef2e08848d6bc587feaf3700db42.tar.bz2
thoughts-42d9db526d3aef2e08848d6bc587feaf3700db42.zip
Added tags
Blogs and streams can now be tagged. Records now show the appropriate tags for an entry. Updates work oddly, because their records show the stream's tags, since updates do not have tags themselves.

refs #2
Diffstat (limited to 'app/models/blog.rb')
-rw-r--r--app/models/blog.rb6
1 files changed, 6 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 @@
1class Blog < ApplicationRecord 1class 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