diff --git a/app/controllers/api/v1/orders_controller.rb b/app/controllers/api/v1/orders_controller.rb index 827244f..0ad3bf4 100644 --- a/app/controllers/api/v1/orders_controller.rb +++ b/app/controllers/api/v1/orders_controller.rb @@ -2,6 +2,7 @@ class Api::V1::OrdersController < ApiController # before_action :get_device_table_mapping, only: [:create] def create + #binding.pry order_time = DateTime.strptime(params[:order_time].to_s,'%s') @order = Order.create(name: params[:name], phone: params[:phone], address: params[:address], order_total: params[:order_total], order_time: order_time, restaurant_owner_id: @user.id) order_detail = params[:order_detail] diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index eb59db4..c8066bf 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -30,6 +30,7 @@ def full_screen def update_status @order = Order.where(id: params[:id]) + if @order.any? @order = @order.first @order.status = params[:status] diff --git a/db/migrate/20160609095604_enable_uuid_extension.rb b/db/migrate/20160609095604_enable_uuid_extension.rb new file mode 100644 index 0000000..0da8023 --- /dev/null +++ b/db/migrate/20160609095604_enable_uuid_extension.rb @@ -0,0 +1,5 @@ +class EnableUuidExtension < ActiveRecord::Migration + def change + enable_extension 'uuid-ossp' + end +end diff --git a/db/migrate/20160609100545_add_uuid_to_categories.rb b/db/migrate/20160609100545_add_uuid_to_categories.rb new file mode 100644 index 0000000..f67a680 --- /dev/null +++ b/db/migrate/20160609100545_add_uuid_to_categories.rb @@ -0,0 +1,5 @@ +class AddUuidToCategories < ActiveRecord::Migration + def change + add_column :categories, :uuid, :uuid, default: 'uuid_generate_v4()' + end +end diff --git a/db/migrate/20160609100553_add_uuid_to_menus.rb b/db/migrate/20160609100553_add_uuid_to_menus.rb new file mode 100644 index 0000000..dd240f0 --- /dev/null +++ b/db/migrate/20160609100553_add_uuid_to_menus.rb @@ -0,0 +1,5 @@ +class AddUuidToMenus < ActiveRecord::Migration + def change + add_column :menus, :uuid, :uuid, default: 'uuid_generate_v4()' + end +end