Files
sx-fc/app/models/booking.rb
2017-06-20 07:36:38 +06:30

20 lines
424 B
Ruby

class Booking < ApplicationRecord
self.primary_key = "booking_id"
#primary key - need to be unique
before_create :generate_custom_id
belongs_to :dining_facility, :optional => true
belongs_to :sale, :optional => true
has_many :booking_orders
has_many :orders, :through => :booking_orders
private
def generate_custom_id
self.booking_id = SeedGenerator.generate_id(self.class.name, "BKI")
end
end