Class: Exo::Admin::SettingsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/exo/admin/settings_controller.rb

Constant Summary collapse

MODEL =
Exo::Setting

Instance Method Summary collapse

Instance Method Details

#createObject



23
24
25
26
27
28
29
30
# File 'app/controllers/exo/admin/settings_controller.rb', line 23

def create
  current_setting.setting_container = for_route? ? current_route : current_site
  if current_setting.save
    redirect_to_parent
  else
    render 'new'
  end
end

#destroyObject



40
41
42
43
44
45
46
47
# File 'app/controllers/exo/admin/settings_controller.rb', line 40

def destroy
  if current_setting.system
    flash[:alert] = "This is a system setting and cannot be required"
  else
    current_setting.destroy
  end
  redirect_to_parent
end

#updateObject



32
33
34
35
36
37
38
# File 'app/controllers/exo/admin/settings_controller.rb', line 32

def update
  if current_setting.update_attributes update_setting_params
    redirect_to_parent
  else
    render 'edit'
  end
end