Sha256: 5c96f6460caf8f5fcacd9bde47ec40d45aa32520a703a113013b74b856657e11
Contents?: true
Size: 956 Bytes
Versions: 4
Compression:
Stored size: 956 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
4 entries across 4 versions & 1 rubygems