gallery/app/models/album.rb

26 lines
703 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
2015-04-16 15:10:25 +00:00
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