Sha256: 2c5609b3ebfb34cb085fddd6db70c4071bce84661a368601b57c10a79d154ac4

Contents?: true

Size: 819 Bytes

Versions: 3

Compression:

Stored size: 819 Bytes

Contents

module Adminpanel
    class Category < ActiveRecord::Base
        attr_accessible :product_ids, :name, :model

        validates_presence_of :model

        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
            "Category"
        end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adminpanel-1.2.12 spec/dummy/app/models/adminpanel/category.rb
adminpanel-1.2.11 spec/dummy/app/models/adminpanel/category.rb
adminpanel-1.2.10 spec/dummy/app/models/adminpanel/category.rb