Storm/app/controllers/settings_controller.rb
Justin Licata c294394704 build User Invitations (#6)
* allow users to invite teammates - WIP.

* hide Sign Up link in views.

* build invitations spec.

* install missing node modules in CircleCI.

* install balloon.css via Yarn.

* disable Hound for JS.

* lint.

* add error messages to invitation view.
2017-07-21 14:56:42 -05:00

30 lines
598 B
Ruby

class SettingsController < ApplicationController
before_action(:authenticate_user!)
before_action(:create_settings, only: %w(edit))
def edit
@setting = Setting.first
end
def update
@setting = Setting.first
if @setting.update(setting_params)
flash[:success] = 'Your settings have been updated.'
redirect_to edit_settings_path
else
render :edit
end
end
private
def setting_params
params.require(:setting).permit(:aws_key, :aws_secret, :slack_url)
end
def create_settings
SettingsCreator.execute if Setting.count.zero?
end
end