Files
sx-fc/app/models/zone.rb
Myat Zin Wai Maw f45849de49 shop
2019-12-13 10:12:08 +06:30

17 lines
406 B
Ruby
Executable File

class Zone < ApplicationRecord
# model association
has_many :tables, dependent: :destroy
has_many :rooms, dependent: :destroy
has_many :order_queue_stations
has_many :cashier_terminals
scope :shop, -> { where("shop_code=?",Shop.current_shop.shop_code) }
# validations
validates_presence_of :name, :created_by
def self.collection
Zone.select("id, name").map { |e| [e.name, e.id] }
end
end