module-and-template-store/app/models/template.rb

34 lines
687 B
Ruby

class Template
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Slug
include Mongoid::Elasticsearch
field :title, type: String
field :author, type: String
field :preview, type: String
field :template, type: String
field :category_id, type: String
field :price, type: Float
field :description, type: String
slug :title, history: true
belongs_to :category
IMAGE_SIZES = {
:thumb => [256, 180]
}
mount_uploader :preview, ImageUploader
mount_uploader :template, ProductUploader
elasticsearch!
SORT_TYPE = %w{Popular New Preferred}
def self.get_categories
categories = Category.where(type: "Extension")
end
end