diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/blog.rb | 12 | ||||
-rw-r--r-- | app/models/entry.rb | 11 |
2 files changed, 10 insertions, 13 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 | ||
diff --git a/app/models/entry.rb b/app/models/entry.rb deleted file mode 100644 index 87fd46d..0000000 --- a/app/models/entry.rb +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | class Entry < ApplicationRecord | ||
2 | has_many :records, as: :recordable, inverse_of: :recordable | ||
3 | |||
4 | validates :slug, presence: true, format: /\A[-a-z0-9]+\z/ | ||
5 | |||
6 | accepts_nested_attributes_for :records, allow_destroy: true | ||
7 | |||
8 | def path | ||
9 | "/says/#{slug}" | ||
10 | end | ||
11 | end | ||