![Justin Licata](/assets/img/avatar_default.png)
* 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.
30 lines
598 B
Ruby
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
|