Class: Api::SettingsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Api::SettingsController
- Defined in:
- app/controllers/api/settings_controller.rb
Instance Method Summary collapse
Instance Method Details
#destroy ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/api/settings_controller.rb', line 27 def destroy unless @config.elements.index(@section) render_404 return end @config.elements.delete @section @config.write_to_file head :no_content # 204 end |
#index ⇒ Object
8 9 10 11 12 |
# File 'app/controllers/api/settings_controller.rb', line 8 def index respond_to do |format| format.json end end |
#update ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/api/settings_controller.rb', line 14 def update coming = Fluent::Config::V1Parser.parse(params[:content], @fluentd.config_file) current = @section index = @config.elements.index current unless index render_404 return end @config.elements[index] = coming.elements.first @config.write_to_file redirect_to api_setting_path(id: element_id(coming.elements.first)) end |