Sha256: 4d7ae0b7d4bd37f6d142bb83f2e0e6bcb2e9cc880b22b46e3706b79e2adedae3
Contents?: true
Size: 923 Bytes
Versions: 1
Compression:
Stored size: 923 Bytes
Contents
module Adminpanel class Category < ActiveRecord::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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
adminpanel-2.0.0 | lib/generators/adminpanel/initialize/templates/category_template.rb |