gallery/app/models/album.rb

26 lines
704 B
Ruby
Raw Normal View History

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
2014-06-13 08:15:13 +00:00
field :rss2_id, type: String
field :order, type: Integer, default: -1
# 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