Sha256: 362f941f726eba02cb8647bc77439ff1ca40691f253b8794dff12a7b9a5b2f14

Contents?: true

Size: 240 Bytes

Versions: 10

Compression:

Stored size: 240 Bytes

Contents

class Category
  include Mongoid::Document

  field :name

  has_many :products

  validates_presence_of :name
  validates_associated :products

  accepts_nested_attributes_for :products, allow_destroy: true

  def to_s
    name
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
iord-1.2.2 test/dummy/app/models/category.rb
iord-1.2.1 test/dummy/app/models/category.rb
iord-1.2.0 test/dummy/app/models/category.rb
iord-1.1.3 test/dummy/app/models/category.rb
iord-1.1.2 test/dummy/app/models/category.rb
iord-1.1.1 test/dummy/app/models/category.rb
iord-1.1.0 test/dummy/app/models/category.rb
iord-1.0.3 test/dummy/app/models/category.rb
iord-1.0.2 test/dummy/app/models/category.rb
iord-1.0.1 test/dummy/app/models/category.rb