menu and menu_category

This commit is contained in:
Min Zeya Phyo
2017-03-27 22:09:16 +06:30
parent 75db4dbc26
commit 40423c12d3
18 changed files with 144 additions and 9 deletions

View File

@@ -0,0 +1,5 @@
class Api::Restaurant::SeatTablesController < ActionController::API
def index
render json: SeatTable.order("order_by")
end
end

6
app/models/menu.rb Normal file
View File

@@ -0,0 +1,6 @@
class Menu < ApplicationRecord
has_many :menu_categories, dependent: :destroy
validates_presence_of :name,:is_active, :valid_days, :valid_time_from, :valid_time_to
end

View File

@@ -0,0 +1,5 @@
class MenuCategory < ApplicationRecord
belongs_to :menu
validates_presence_of :name
end

6
app/models/room.rb Normal file
View File

@@ -0,0 +1,6 @@
class Room < ApplicationRecord
belongs_to :zone
validates_presence_of :name,:seater, :order_by, :created_by, :is_active
end

View File

@@ -1,6 +1,7 @@
class Zone < ApplicationRecord
# model association
has_many :seat_tables, dependent: :destroy
has_many :rooms, dependent: :destroy
# validations
validates_presence_of :name, :created_by