Sha256: e958ea9b510171cc180dac0cc4ac3f1b25854539e62f871b8d6ccc00ad58b70c

Contents?: true

Size: 762 Bytes

Versions: 3

Compression:

Stored size: 762 Bytes

Contents

module Adminpanel
  class Category < ActiveRecord::Base
    include Adminpanel::Base
    validates_presence_of :model
    validates_presence_of :name

    has_many :categorizations
    has_many :products, :through => :categorizations, :dependent => :destroy


    def self.form_attributes
      [
				{"name" => {"type" => "text_field", "name" => "name", "label" => "name", "placeholder" => "name"}},
				# {'model' => {"type" => "text_field", "name" => "name", "label" => "name", "placeholder" => "name", 'show' => 'false'}},
				{"product_ids" => {"type" => "has_many", "model" => "Adminpanel::Product", "name" => "product_ids"}},
      ]
    end

    def self.display_name
        "Categoria"
    end

    def self.icon
        "icon-truck"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adminpanel-2.1.2 test/dummy/app/models/adminpanel/category.rb
adminpanel-2.1.1 test/dummy/app/models/adminpanel/category.rb
adminpanel-2.1.0 spec/dummy/app/models/adminpanel/category.rb