Sha256: 38aa2bf7e1a41533a69095f61eedd5848388d0ec49506719865f5727f7352dfb

Contents?: true

Size: 909 Bytes

Versions: 3

Compression:

Stored size: 909 Bytes

Contents

class Radmin::SettingsController < RadminController
  load_and_authorize_resource :class => "Radmin::Setting"
	
  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
  
  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
  
  def destroy
    @setting.destroy
    flash[:notice] = Radmin::I18n.t(:setting_sucessfully_deleted, :default => "Setting sucessfully deleted.")
    redirect_to admin_settings_url
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
radmin-0.3.3 app/controllers/radmin/settings_controller.rb
radmin-0.3.2 app/controllers/radmin/settings_controller.rb
radmin-0.3.1 app/controllers/radmin/settings_controller.rb