diff --git a/app/models/author.rb b/app/models/author.rb index e399202..9f3a806 100644 --- a/app/models/author.rb +++ b/app/models/author.rb @@ -1,2 +1,4 @@ class Author < ApplicationRecord + validates :first_name, presence: true + validates :last_name, presence: true end diff --git a/app/models/book.rb b/app/models/book.rb index 1b16bc8..860c5d5 100644 --- a/app/models/book.rb +++ b/app/models/book.rb @@ -2,4 +2,7 @@ class Book < ApplicationRecord has_and_belongs_to_many :authors scope :published, -> { where(published: true) } + validates :title, presence: true + validates :price, presence: true + validates :published, presence: true end