Class: Admin::FlashSalesController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- ApplicationController
- BaseController
- Admin::FlashSalesController
- Defined in:
- app/controllers/admin/flash_sales_controller.rb
Constant Summary
Constants inherited from BaseController
BaseController::INTERNAL_SERVER_ERROR_MESSAGE
Instance Method Summary collapse
Methods inherited from BaseController
#destroy_session, #identity_cache_memoization, #sign_in_page, #user_developer_session
Methods included from LogrageCustomLogger
Methods included from AdminHelper
#dynamic_pricings_formatter, #link_to_admin_reservations_path_by_id, #link_to_admin_restaurants_path_by_id, #link_to_log, #optional_locales, #optional_locales_with_labels, #staff_signed_in?
Methods included from UpdateLocaleConcern
Methods inherited from ApplicationController
#after_sign_in_path_for, #after_sign_out_path_for, #default_url_options, #identity_cache_memoization, #render_not_found, #routing_error, search_params_key=
Methods included from ControllerHelpers
#check_boolean_param, #get_banners, #inventory_params, #reservation_params
Instance Method Details
#create ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/admin/flash_sales_controller.rb', line 29 def create @flash_sale = FlashSale.new(flash_sale_params) if @flash_sale.save render json: @flash_sale, serializer: Admin::FlashSaleSerializer, adapter: :json_api else render json: { success: false, message: @flash_sale.errors..to_sentence } end end |
#destroy ⇒ Object
40 41 42 43 44 |
# File 'app/controllers/admin/flash_sales_controller.rb', line 40 def destroy @flash_sale.destroy render json: { success: true } end |
#index ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/admin/flash_sales_controller.rb', line 8 def index respond_to do |format| format.html format.json do render json: FlashSale.order(slot_date: :desc), each_serializer: Admin::FlashSaleSerializer, adapter: :json_api end end end |
#update ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/admin/flash_sales_controller.rb', line 19 def update if @flash_sale.update(flash_sale_params) render json: @flash_sale, serializer: Admin::FlashSaleSerializer, adapter: :json_api else render json: { success: false, message: @flash_sale.errors..to_sentence } end end |