profiles_controller.rb 552 B

1234567891011121314151617181920212223242526272829
  1. # frozen_string_literal: true
  2. class Settings::ProfilesController < ApplicationController
  3. layout 'auth'
  4. before_action :authenticate_user!
  5. before_action :set_account
  6. def show
  7. end
  8. def update
  9. if @account.update(account_params)
  10. redirect_to settings_profile_path, notice: 'Changes successfully saved!'
  11. else
  12. render action: :show
  13. end
  14. end
  15. private
  16. def account_params
  17. params.require(:account).permit(:display_name, :note, :avatar, :header)
  18. end
  19. def set_account
  20. @account = current_user.account
  21. end
  22. end