diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-07-02 18:03:37 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-07-03 14:01:41 -0400 |
commit | 49b11f2864f75bcfb8d0d01439939ed68aa90b8f (patch) | |
tree | c91d0976e9cb54562aa2c19f9648235d74f14cbf /app/models/blog.rb | |
parent | cb01d13034ad41a29533b623cbbf7c23b37a231c (diff) | |
download | thoughts-49b11f2864f75bcfb8d0d01439939ed68aa90b8f.tar.gz thoughts-49b11f2864f75bcfb8d0d01439939ed68aa90b8f.tar.bz2 thoughts-49b11f2864f75bcfb8d0d01439939ed68aa90b8f.zip |
Collapsed Entry -> Blog single-table inheritance to Blog
Diffstat (limited to 'app/models/blog.rb')
-rw-r--r-- | app/models/blog.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/blog.rb b/app/models/blog.rb index d2b1c27..1ace11b 100644 --- a/app/models/blog.rb +++ b/app/models/blog.rb | |||
@@ -1,4 +1,12 @@ | |||
1 | class Blog < Entry | 1 | class Blog < ApplicationRecord |
2 | has_many :records, as: :recordable, inverse_of: :recordable | ||
3 | |||
2 | validates :title, :body, presence: true | 4 | validates :title, :body, presence: true |
3 | end | 5 | validates :slug, presence: true, format: /\A[-a-z0-9]+\z/ |
4 | 6 | ||
7 | accepts_nested_attributes_for :records, allow_destroy: true | ||
8 | |||
9 | def path | ||
10 | "/says/#{slug}" | ||
11 | end | ||
12 | end | ||