Class: Admin::VoucherIntrosController
Constant Summary
BaseController::INTERNAL_SERVER_ERROR_MESSAGE
Instance Method Summary
collapse
#destroy_session, #identity_cache_memoization, #sign_in_page, #user_developer_session
#append_info_to_payload
#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?
#setup_locale
#after_sign_in_path_for, #after_sign_out_path_for, #default_url_options, #identity_cache_memoization, #render_not_found, #routing_error, search_params_key=
#check_boolean_param, #get_banners, #inventory_params, #reservation_params
Instance Method Details
#create ⇒ Object
16
17
18
19
20
21
22
23
24
25
|
# File 'app/controllers/admin/voucher_intros_controller.rb', line 16
def create
@voucher_intro = Vouchers::Intro.new permitted_params
if voucher_intro.valid? && voucher_intro.save
redirect_to admin_voucher_intros_path,
notice: 'Voucher Intro created successfully'
else
flash[:alert] = voucher_intro.errors.full_messages.to_sentence
render :new
end
end
|
#destroy ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'app/controllers/admin/voucher_intros_controller.rb', line 42
def destroy
if voucher_intro.destroy
flash[:notice] = "#{voucher_intro.section_type} deleted successfully"
else
flash[:alert] = voucher_intro.errors.full_messages.to_sentence
end
redirect_back fallback_location: back_fallback_location
end
|
#edit ⇒ Object
29
|
# File 'app/controllers/admin/voucher_intros_controller.rb', line 29
def edit; end
|
#index ⇒ Object
8
9
10
|
# File 'app/controllers/admin/voucher_intros_controller.rb', line 8
def index
@voucher_intros = Vouchers::Intro.includes(:translations)
end
|
#new ⇒ Object
12
13
14
|
# File 'app/controllers/admin/voucher_intros_controller.rb', line 12
def new
@voucher_intro = Vouchers::Intro.new
end
|
#show ⇒ Object
27
|
# File 'app/controllers/admin/voucher_intros_controller.rb', line 27
def show; end
|
#update ⇒ Object
31
32
33
34
35
36
37
38
39
40
|
# File 'app/controllers/admin/voucher_intros_controller.rb', line 31
def update
voucher_intro.attributes = permitted_params
if voucher_intro.valid? && voucher_intro.save
redirect_to admin_voucher_intros_path,
notice: 'Voucher Intro updated successfully'
else
flash[:alert] = voucher_intro.errors.full_messages.to_sentence
render :edit
end
end
|