9 lines
222 B
Ruby
9 lines
222 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Book < ApplicationRecord
|
|
has_and_belongs_to_many :authors
|
|
|
|
scope :published, -> { where(published: true) }
|
|
validates :title, presence: true
|
|
validates :price, presence: true
|
|
end
|