Sha256: eadd69d97e8f3a600caa6765eab04753e7c110f72a556c79002b8aad6b9be58e

Contents?: true

Size: 871 Bytes

Versions: 29

Compression:

Stored size: 871 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

    has_and_belongs_to_many :test_objects,
        join_table: "adminpanel_test_object_category"

    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

29 entries across 29 versions & 1 rubygems

Version Path
adminpanel-2.5.2 test/dummy/app/models/adminpanel/category.rb
adminpanel-2.5.1 test/dummy/app/models/adminpanel/category.rb
adminpanel-2.5.0 test/dummy/app/models/adminpanel/category.rb
adminpanel-2.4.3 test/dummy/app/models/adminpanel/category.rb
adminpanel-2.4.2 test/dummy/app/models/adminpanel/category.rb
adminpanel-2.4.1 test/dummy/app/models/adminpanel/category.rb
adminpanel-2.4.0 test/dummy/app/models/adminpanel/category.rb
adminpanel-2.3.1 test/dummy/app/models/adminpanel/category.rb
adminpanel-2.3.0 test/dummy/app/models/adminpanel/category.rb