Sha256: 712aa80c0256b52158b445cd7726297d05984fd87159a719b96377f3b85d1bd5

Contents?: true

Size: 491 Bytes

Versions: 12

Compression:

Stored size: 491 Bytes

Contents

class Book < ActiveRecord::Base
  belongs_to :author, optional: true
  has_many :chapters, -> { order(:item_position) }, inverse_of: :book
  has_many :book_sequels, dependent: :destroy
  has_many :sequels, through: :book_sequels

  validates_presence_of :title

  translates :description
  globalize_accessors

  # chapters may not be destroy
  accepts_nested_attributes_for :chapters
  accepts_nested_attributes_for :book_sequels, allow_destroy: true

  dragonfly_accessor :cover_image
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
releaf-core-3.1.0 lib/generators/dummy/templates/models/book.rb
releaf-core-3.0.3 lib/generators/dummy/templates/models/book.rb
releaf-core-3.0.2 lib/generators/dummy/templates/models/book.rb
releaf-core-3.0.1 lib/generators/dummy/templates/models/book.rb
releaf-core-3.0.0 lib/generators/dummy/templates/models/book.rb
releaf-core-2.2.1 lib/generators/dummy/templates/models/book.rb
releaf-core-2.2.0 lib/generators/dummy/templates/models/book.rb
releaf-core-2.1.2 lib/generators/dummy/templates/models/book.rb
releaf-core-2.1.1 lib/generators/dummy/templates/models/book.rb
releaf-core-2.1.0 lib/generators/dummy/templates/models/book.rb
releaf-core-2.0.1 lib/generators/dummy/templates/models/book.rb
releaf-core-2.0.0 lib/generators/dummy/templates/models/book.rb