Zone Created_at Bug Fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class Settings::RoomsController < ApplicationController
|
||||
before_action :set_settings_room, only: [:show, :edit, :update, :destroy]
|
||||
before_action :set_settings_zone, only: [:index, :show, :edit, :new, :update,:create]
|
||||
before_action :set_settings_zone, only: [:index, :show, :edit, :new, :update,:create,:destroy]
|
||||
# GET /settings/rooms
|
||||
# GET /settings/rooms.json
|
||||
def index
|
||||
@@ -28,9 +28,10 @@ class Settings::RoomsController < ApplicationController
|
||||
@settings_room = Room.new(settings_room_params)
|
||||
@settings_room.type = DiningFacility::ROOM_TYPE
|
||||
@settings_room.zone_id = params[:zone_id]
|
||||
@settings_room.created_by = current_login_employee.name
|
||||
respond_to do |format|
|
||||
if @settings_room.save
|
||||
format.html { redirect_to settings_zone_rooms_path, notice: 'Room was successfully created.' }
|
||||
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @settings_room }
|
||||
else
|
||||
puts "abc"
|
||||
@@ -43,9 +44,10 @@ class Settings::RoomsController < ApplicationController
|
||||
# PATCH/PUT /settings/rooms/1
|
||||
# PATCH/PUT /settings/rooms/1.json
|
||||
def update
|
||||
@settings_room.created_by = current_login_employee.name
|
||||
respond_to do |format|
|
||||
if @settings_room.update(settings_room_params)
|
||||
format.html { redirect_to settings_zone_rooms_path, notice: 'Room was successfully updated.' }
|
||||
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_room }
|
||||
else
|
||||
format.html { render :edit }
|
||||
@@ -59,7 +61,7 @@ class Settings::RoomsController < ApplicationController
|
||||
def destroy
|
||||
@settings_room.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_zones_path, notice: 'Room was successfully destroyed.' }
|
||||
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user