Class: Cardboard::SettingsController

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

Instance Method Summary collapse

Instance Method Details

#indexObject



7
8
9
# File 'app/controllers/cardboard/settings_controller.rb', line 7

def index
  @setting = Setting.first
end

#updateObject



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

def update
  @setting = params[:id].present? ? Setting.find(params[:id]) : Setting.first
  if @setting.update_attributes(strong_params[:setting])
    flash[:success] = "Settings updated successfully"
    redirect_to settings_path
  else
    render :index
  end
end