Class: Admin::SettingsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- ApplicationController
- BaseController
- Admin::SettingsController
- Defined in:
- app/controllers/admin/settings_controller.rb
Overview
typed: ignore frozen_string_literal: true
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
#index ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/admin/settings_controller.rb', line 7 def index title: 'Admin Settings' hidden_fields = [ 'avg_restaurants_reviews_count', 'avg_restaurants_reviews_score', 'all_stars', 'total_reviews', ] @settings = (AdminSetting.keys - hidden_fields).map do |key| [key, AdminSetting.send(key.to_sym)] end.to_h respond_to do |format| format.html format.json do render json: @settings.to_json end end end |
#update ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/admin/settings_controller.rb', line 28 def update updater = AdminSettingUpdater.new result = updater.update(setting_param) if result.success? redirect_to admin_settings_path, notice: 'Settings updated successfully' else redirect_to admin_settings_path, alert: updater.errors..to_sentence end end |