gallery/app/models/album.rb

25 lines
661 B
Ruby
Raw Permalink 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
# 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