Sha256: 1d1a82ec09a54ec4d9af17fd9d8238a243e02a31786cec26ad000ddc84fc6c07

Contents?: true

Size: 268 Bytes

Versions: 7

Compression:

Stored size: 268 Bytes

Contents

class Category < ::ActiveRecord::Base
  validates :name, :length => { :minimum => 5 }

  has_many :products

  belongs_to :parent, :class_name => self.name, :foreign_key => :parent_id
  has_many :subcategories, :class_name => self.name, :foreign_key => :parent_id
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
trax_controller-1.0.0 spec/internal/app/models/category.rb
trax_controller-0.1.4 spec/internal/app/models/category.rb
trax_controller-0.1.3 spec/internal/app/models/category.rb
trax_controller-0.1.2 spec/internal/app/models/category.rb
trax_controller-0.1.1 spec/internal/app/models/category.rb
trax_controller-0.1.0 spec/internal/app/models/category.rb
trax_controller-0.0.4 spec/internal/app/models/category.rb