Class: Sail::SettingsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Sail::SettingsController
- Defined in:
- app/controllers/sail/settings_controller.rb
Overview
SettingsController This is the main controller for settings Implements all actions for the dashboard and for the JSON API
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
9 10 11 12 13 14 |
# File 'app/controllers/sail/settings_controller.rb', line 9 def index @settings = Setting.by_query(s_params[:query]) @number_of_pages = (@settings.count.to_f / Sail::Setting::SETTINGS_PER_PAGE).ceil @settings = @settings.paginated(s_params[:page]) fresh_when(@settings) end |
#reset ⇒ Object
52 53 54 55 56 57 |
# File 'app/controllers/sail/settings_controller.rb', line 52 def reset respond_to do |format| @setting, @successful_update = Setting.reset(s_params[:name]) format.js { render :update } end end |
#show ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/sail/settings_controller.rb', line 24 def show respond_to do |format| format.json do render json: { value: Sail::Setting.get(s_params[:name]) } end end end |
#switcher ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/sail/settings_controller.rb', line 34 def switcher respond_to do |format| format.json do begin render json: { value: Sail::Setting.switcher(positive: s_params[:positive], negative: s_params[:negative], throttled_by: s_params[:throttled_by]) } rescue Sail::Setting::UnexpectedCastType head(:bad_request) rescue ActiveRecord::RecordNotFound head(:not_found) end end end end |