Class: Golden::Setting::SettingsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/golden/setting/settings_controller.rb

Instance Method Summary collapse

Instance Method Details

#batch_updateObject



52
53
54
55
56
57
# File 'app/controllers/golden/setting/settings_controller.rb', line 52

def batch_update
  params[:setting].each do |setting, value|
    @setting_class.send "#{setting}=", value
  end if params[:setting]
  redirect_to action: :index
end

#createObject



30
31
32
33
# File 'app/controllers/golden/setting/settings_controller.rb', line 30

def create
  @setting.save
  respond_with @setting, location: setting_path(@setting)
end

#destroyObject



42
43
44
45
# File 'app/controllers/golden/setting/settings_controller.rb', line 42

def destroy
  @setting.destroy
  respond_with @setting, location: settings_path
end

#editObject



27
28
# File 'app/controllers/golden/setting/settings_controller.rb', line 27

def edit
end

#indexObject



14
15
16
17
# File 'app/controllers/golden/setting/settings_controller.rb', line 14

def index
  @default_tab = Golden::Setting.default_tab
  respond_with @settings
end

#listObject



47
48
49
50
# File 'app/controllers/golden/setting/settings_controller.rb', line 47

def list
  @settings = @settings.paginate page: params[:page]
  respond_with @settings
end

#newObject



23
24
25
# File 'app/controllers/golden/setting/settings_controller.rb', line 23

def new
  respond_with @setting
end

#showObject



19
20
21
# File 'app/controllers/golden/setting/settings_controller.rb', line 19

def show
  respond_with @setting
end

#updateObject



35
36
37
38
39
40
# File 'app/controllers/golden/setting/settings_controller.rb', line 35

def update
  value = params[:setting].delete :value
  @setting.value = value
  @setting.update_attributes setting_params
  respond_with @setting, location: setting_path(@setting)
end