From ad80c40944743515a45d70014e8d5ffb88cd74fc Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 25 Jun 2017 00:00:28 -0400 Subject: Started designing index page --- app/models/blog.rb | 4 ++++ app/models/entry.rb | 9 +++++++++ app/models/record.rb | 5 +++++ 3 files changed, 18 insertions(+) create mode 100644 app/models/blog.rb create mode 100644 app/models/entry.rb create mode 100644 app/models/record.rb (limited to 'app/models') 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 @@ +class Blog < Entry + validates :title, :body, presence: true +end + 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 @@ +class Entry < ApplicationRecord + has_many :records, as: :recordable + + validates :slug, presence: true, format: /\A[-a-z0-9]+\z/ + + def path + "/says/#{slug}" + end +end 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 @@ +class Record < ApplicationRecord + belongs_to :recordable, polymorphic: true + + validates :description, :recordable, presence: true +end -- cgit 1.4.1