From 42d9db526d3aef2e08848d6bc587feaf3700db42 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 7 Jul 2018 16:23:04 -0400 Subject: 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 --- app/models/blog.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/models/blog.rb') 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 @@ class Blog < ApplicationRecord include Recordable + acts_as_taggable + validates :title, presence: true validates :body, presence: true, if: :published validates :slug, presence: true, format: /\A[-a-z0-9]+\z/, if: :published @@ -12,6 +14,10 @@ class Blog < ApplicationRecord "/says/#{slug}" end + def taggable + self + end + private def set_draft_title if self.title.blank? and not self.published -- cgit 1.4.1