tap/app/models/barcode.rb

21 lines
441 B
Ruby
Raw Normal View History

2015-09-23 09:09:24 +00:00
# == Schema Information
#
# Table name: barcodes
#
# id :integer not null, primary key
# product_id :integer
# code :string default(""), not null
# created_at :datetime
# updated_at :datetime
#
class Barcode < ActiveRecord::Base
include FriendlyId
friendly_id :code, use: :finders
2015-09-23 09:09:24 +00:00
belongs_to :product
2015-10-28 20:54:55 +00:00
validates :product, presence: true
validates :code, presence: true, uniqueness: true
2015-09-23 09:09:24 +00:00
end