15 lines
386 B
Ruby
15 lines
386 B
Ruby
class Booking < ApplicationRecord
|
|
before_create :generate_custom_id
|
|
#primary key - need to be unique
|
|
|
|
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
|