Class: Manage::ConfigsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/manage/configs_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#json_request?, #limit_write_access_to_admins, #logged_in, #require_admin_or_limited_admin, #require_admin_or_limited_admin_or_event_tracking, #response_view_or_errors

Instance Method Details

#editObject



12
13
# File 'app/controllers/manage/configs_controller.rb', line 12

def edit
end

#indexObject



7
8
9
10
# File 'app/controllers/manage/configs_controller.rb', line 7

def index
  @config = HackathonConfig.get_all
  respond_with(HackathonConfig.get_all)
end

#updateObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/manage/configs_controller.rb', line 15

def update
  key = @config.var.to_sym
  value = params[:hackathon_config][key]
  value = true if value == 'true'
  value = false if value == 'false'
  if @config.value != value
    @config.value = value
    @config.save
    redirect_to manage_configs_path, notice: "Config \"#{key}\" has been updated."
  else
    redirect_to manage_configs_path, notice: "Config \"#{key}\" was not changed"
  end
end