about summary refs log tree commit diff stats
path: root/app/models
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-06-25 00:00:28 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-06-25 00:00:28 -0400
commitad80c40944743515a45d70014e8d5ffb88cd74fc (patch)
tree0e97b3d46f3ed3594a1e4074e4a5a06deefcd76d /app/models
parent5581530930129d7854ed5d99d058939ad9c790c2 (diff)
downloadthoughts-ad80c40944743515a45d70014e8d5ffb88cd74fc.tar.gz
thoughts-ad80c40944743515a45d70014e8d5ffb88cd74fc.tar.bz2
thoughts-ad80c40944743515a45d70014e8d5ffb88cd74fc.zip
Started designing index page
Diffstat (limited to 'app/models')
-rw-r--r--app/models/blog.rb4
-rw-r--r--app/models/entry.rb9
-rw-r--r--app/models/record.rb5
3 files changed, 18 insertions, 0 deletions
diff --git a/app/models/blog.rb b/app/models/blog.rb new file mode 100644 index 0000000..d2b1c27 --- /dev/null +++ b/app/models/blog.rb
@@ -0,0 +1,4 @@
1class Blog < Entry
2 validates :title, :body, presence: true
3end
4
diff --git a/app/models/entry.rb b/app/models/entry.rb new file mode 100644 index 0000000..22b330a --- /dev/null +++ b/app/models/entry.rb
@@ -0,0 +1,9 @@
1class Entry < ApplicationRecord
2 has_many :records, as: :recordable
3
4 validates :slug, presence: true, format: /\A[-a-z0-9]+\z/
5
6 def path
7 "/says/#{slug}"
8 end
9end
diff --git a/app/models/record.rb b/app/models/record.rb new file mode 100644 index 0000000..5837702 --- /dev/null +++ b/app/models/record.rb
@@ -0,0 +1,5 @@
1class Record < ApplicationRecord
2 belongs_to :recordable, polymorphic: true
3
4 validates :description, :recordable, presence: true
5end