35 lines
1.0 KiB
Ruby
35 lines
1.0 KiB
Ruby
class Publication
|
|
include Mongoid::Document
|
|
include Mongoid::Timestamps
|
|
include OrbitModel::Status
|
|
include OrbitTag::Taggable
|
|
include OrbitCategory::Categorizable
|
|
include Slug
|
|
|
|
field :title, type: String, localize: true
|
|
field :pub_date, type: DateTime
|
|
field :author, type: String, localize: true
|
|
field :author_description, type: String, localize: true
|
|
field :pub_information, localize: true
|
|
|
|
mount_uploader :cover, ImageUploader
|
|
field :cover_description, type: String
|
|
|
|
field :is_external_link, :type => Boolean, :default => false
|
|
field :external_link
|
|
|
|
field :is_online_flipping_reader, :type => Boolean, :default => false
|
|
|
|
has_many :full_files, :dependent => :destroy, :class_name => "PublicationFile"
|
|
has_many :publication_links, :autosave => true, :dependent => :destroy
|
|
|
|
accepts_nested_attributes_for :full_files, :allow_destroy => true
|
|
accepts_nested_attributes_for :publication_links, :allow_destroy => true
|
|
|
|
has_many :chapters, dependent: :destroy
|
|
|
|
def full_file
|
|
full_files[0]
|
|
end
|
|
end
|