26 lines
703 B
Ruby
26 lines
703 B
Ruby
class Album
|
|
include Mongoid::Document
|
|
include Mongoid::Timestamps
|
|
|
|
include OrbitCategory::Categorizable
|
|
include OrbitTag::Taggable
|
|
include Slug
|
|
|
|
field :name, as: :slug_title, localize: true
|
|
field :description, localize: true
|
|
field :cover, default: "default"
|
|
field :cover_path #can refact
|
|
field :tag_names
|
|
field :uid, type: String
|
|
field :rss2_id, type: String
|
|
field :order, type: Integer, default: 0
|
|
|
|
# has_and_belongs_to_many :tags, :class_name => "GalleryTag"
|
|
has_many :album_images, :autosave => true, :dependent => :destroy
|
|
accepts_nested_attributes_for :album_images, :allow_destroy => true
|
|
|
|
def self.find_by_param(input)
|
|
self.find_by(uid: input)
|
|
end
|
|
|
|
end |