menu and menu_category
This commit is contained in:
5
app/controllers/api/restaurant/seat_tables_controller.rb
Normal file
5
app/controllers/api/restaurant/seat_tables_controller.rb
Normal 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
6
app/models/menu.rb
Normal 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
|
||||
5
app/models/menu_category.rb
Normal file
5
app/models/menu_category.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class MenuCategory < ApplicationRecord
|
||||
belongs_to :menu
|
||||
|
||||
validates_presence_of :name
|
||||
end
|
||||
6
app/models/room.rb
Normal file
6
app/models/room.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class Room < ApplicationRecord
|
||||
belongs_to :zone
|
||||
|
||||
validates_presence_of :name,:seater, :order_by, :created_by, :is_active
|
||||
|
||||
end
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user