Class: SettingsController

Inherits:
ApplicationController show all
Includes:
Foreman::Controller::AutoCompleteSearch
Defined in:
app/controllers/settings_controller.rb

Instance Method Summary collapse

Methods included from Foreman::Controller::AutoCompleteSearch

#auto_complete_search, #invalid_search_query

Methods inherited from ApplicationController

#api_request?, #welcome

Methods included from Foreman::ThreadSession::Cleaner

#clear_thread, included

Instance Method Details

#indexObject


5
6
7
8
9
10
11
# File 'app/controllers/settings_controller.rb', line 5

def index
  @settings = Setting.live_descendants.search_for(params[:search])
  respond_to do |format|
    format.html
    format.json { render :json => @settings.all}
  end
end

#updateObject


13
14
15
16
17
18
19
20
# File 'app/controllers/settings_controller.rb', line 13

def update
  @setting = Setting.find(params[:id])
  if @setting.parse_string_value(params[:setting][:value]) && @setting.save
    process_success
  else
    process_error
  end
end