gallery/app/models/album.rb

24 lines
630 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
# 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