Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # == Schema Information
- #
- # Table name: book_authors
- #
- # id :bigint not null, primary key
- # book_id :bigint
- # author_name :string
- # created_at :datetime not null
- # updated_at :datetime not null
- #
- class BookAuthor < ApplicationRecord
- belongs_to :book
- validates :author_name, presence: true, uniqueness: { scope: :book_id,
- message: 'already added to this book'}
- end
Add Comment
Please, Sign In to add comment