Sha256: 6a0fc81439b747b0ec778a320e9b4f9f8690e327106ce029d17ef46b71462d49
Contents?: true
Size: 952 Bytes
Versions: 16
Compression:
Stored size: 952 Bytes
Contents
module Adminpanel class Category < ActiveRecord::Base include Adminpanel::Base validates_presence_of :model validates_presence_of :name validates_uniqueness_of :name # has_many :categorizations # has_many :products, :through => :categorizations, :dependent => :destroy def self.form_attributes [ # { # 'product_ids' => { # 'type' => 'has_many', # 'model' => 'Adminpanel::Product', # 'name' => 'product_ids' # } # }, { 'name' => { 'type' => 'text_field', 'name' => 'name', 'label' => 'name', 'placeholder' => 'name' } }, ] end def self.display_name "Categoria" #singular end def self.icon "bookmark" #fa-{icon} end default_scope { order("model ASC")} scope :of_model, lambda{|model| where(:model => model)} end end
Version data entries
16 entries across 16 versions & 1 rubygems