Class: Shoppy::SettingsController

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

Direct Known Subclasses

SettingsController

Instance Method Summary collapse

Instance Method Details

#editObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/shoppy/settings_controller.rb', line 9

def edit
  def edit
  @setting = Setting.first
  if @setting.update_attributes(setting_params)
    Log.newEvent("Settings", "Settings were updated", current_admin.name)
    flash[:notice] = "Settings have been updated."
  else
    flash[:errors] = @setting.errors.messages
  end
  redirect_to "/settings"
end

def setting_params
  params.require(:setting).permit(:app_name, :hostname, :base_url, :accounts_email_sender, :notification_email_sender, :currency_unit, :license_key)
end
end

#setting_paramsObject



21
22
23
# File 'app/controllers/shoppy/settings_controller.rb', line 21

def setting_params
  params.require(:setting).permit(:app_name, :hostname, :base_url, :accounts_email_sender, :notification_email_sender, :currency_unit, :license_key)
end

#showObject



5
6
7
# File 'app/controllers/shoppy/settings_controller.rb', line 5

def show
  @setting = Setting.first
end