29 lines
718 B
Ruby
29 lines
718 B
Ruby
class Chapter
|
|
include Mongoid::Document
|
|
include Slug
|
|
include OrbitTag::Taggable
|
|
|
|
field :title, type: String, localize: true
|
|
field :author, type: String, localize: true
|
|
field :author_description, type: String, localize: true
|
|
field :author_url, type: String
|
|
field :text, localize: true
|
|
field :page, type: String
|
|
field :sort_number, type: Integer
|
|
|
|
|
|
field :is_online_flipping_reader, :type => Boolean, :default => false
|
|
|
|
field :keywords, type: String, localize: true
|
|
|
|
belongs_to :publication
|
|
|
|
has_many :chapter_files, :dependent => :destroy, :class_name => "ChapterFile"
|
|
|
|
accepts_nested_attributes_for :chapter_files, :allow_destroy => true
|
|
|
|
def chapter_file
|
|
chapter_files[0]
|
|
end
|
|
end
|