about summary refs log tree commit diff stats
path: root/app/models/blog.rb
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-10-14 10:15:24 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-10-14 10:15:24 -0400
commit0aace2986a9a7a6d4c84a9ba6819d3df7821e267 (patch)
tree450acd91cbd522d47577233ca28725ede6697bb2 /app/models/blog.rb
parent07ac5db98c8884e0de81fc6c0ab873854a852ca5 (diff)
downloadthoughts-0aace2986a9a7a6d4c84a9ba6819d3df7821e267.tar.gz
thoughts-0aace2986a9a7a6d4c84a9ba6819d3df7821e267.tar.bz2
thoughts-0aace2986a9a7a6d4c84a9ba6819d3df7821e267.zip
Blogs have an author now
Diffstat (limited to 'app/models/blog.rb')
-rw-r--r--app/models/blog.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/blog.rb b/app/models/blog.rb index e640466..e43990e 100644 --- a/app/models/blog.rb +++ b/app/models/blog.rb
@@ -4,10 +4,12 @@ class Blog < ApplicationRecord
4 acts_as_taggable 4 acts_as_taggable
5 5
6 has_many :comments 6 has_many :comments
7 belongs_to :user
7 8
8 validates :title, presence: true 9 validates :title, presence: true
9 validates :body, presence: true, if: :published 10 validates :body, presence: true, if: :published
10 validates :slug, presence: true, format: /\A[-a-z0-9]+\z/, if: :published 11 validates :slug, presence: true, format: /\A[-a-z0-9]+\z/, if: :published
12 validates :user, presence: true
11 13
12 before_validation :set_draft_title 14 before_validation :set_draft_title
13 before_save :set_published_at 15 before_save :set_published_at