Sha256: c5c17eb76dc72783d300e7ca6e6eba8d4a3243afd3e1e8e7d4aadba31642a885

Contents?: true

Size: 984 Bytes

Versions: 1

Compression:

Stored size: 984 Bytes

Contents

module Adminpanel
  class Department < ActiveRecord::Base
    include Adminpanel::Base

    belongs_to :category

		has_many :items
		has_many :product, :through => :items, :dependent => :destroy

    def self.form_attributes
      [
        {
          'category_id' => {
            'type' => 'belongs_to',
            'label' => 'category',
            'placeholder' => 'category',
            'model' => 'Adminpanel::Category',
          }
        },
        {
          'product_ids' => {
            'type' => 'has_many',
            'label' => 'product',
            'placeholder' => 'product',
            'model' => 'Adminpanel::Product',
          }
        },
        {
          'name' => {
            'type' => 'text_field',
            'label' => 'name',
            'placeholder' => 'name',
          }
        },

      ]
    end

    def self.display_name
      'Departamento' #singular
    end

    # def self.icon
    #     "truck" # fa-{icon}
    # end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adminpanel-2.1.2 test/dummy/app/models/adminpanel/department.rb