2021-03-22 03:16:29 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-03-19 17:31:38 +02:00
|
|
|
class Book < ApplicationRecord
|
|
|
|
has_and_belongs_to_many :authors
|
|
|
|
|
|
|
|
scope :published, -> { where(published: true) }
|
2021-03-21 17:06:54 +01:00
|
|
|
validates :title, presence: true
|
|
|
|
validates :price, presence: true
|
2021-03-19 17:31:38 +02:00
|
|
|
end
|