Class: Radmin::SettingsController

Inherits:
RadminController show all
Defined in:
app/controllers/radmin/settings_controller.rb

Instance Method Summary collapse

Methods inherited from RadminController

#current_ability

Instance Method Details

#createObject



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

def create
  Radmin::Setting["#{params[:setting]['key']}"] = params[:setting]['value']
  flash[:notice] = Radmin::I18n.t(:setting_sucessfully_created, :default => "Setting sucessfully created.")
  redirect_to admin_settings_url
rescue ActiveRecord::RecordInvalid
  render :action => :new
end

#destroyObject



21
22
23
24
25
# File 'app/controllers/radmin/settings_controller.rb', line 21

def destroy
  @setting.destroy
  flash[:notice] = Radmin::I18n.t(:setting_sucessfully_deleted, :default => "Setting sucessfully deleted.")
  redirect_to admin_settings_url
end

#updateObject



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

def update
  @setting.value = params[:setting]['value']
  @setting.save!
  flash[:notice] = Radmin::I18n.t(:setting_sucessfully_updated, :default => "Setting sucessfully updated.")
  redirect_to admin_settings_url
rescue ActiveRecord::RecordInvalid
  render :action => :edit
end