mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-25 08:09:38 +02:00
Add new settings profile and preferences pages (#672)
* Add new settings profile and preferences pages * Fix lint errors
This commit is contained in:
parent
ad4de99f1a
commit
5a5f13b46b
15 changed files with 192 additions and 32 deletions
|
@ -5,13 +5,13 @@ class Settings::ProfilesController < ApplicationController
|
|||
def update
|
||||
user_params_with_family = user_params
|
||||
|
||||
if Current.family
|
||||
if Current.family && user_params_with_family[:family_attributes]
|
||||
family_attributes = user_params_with_family[:family_attributes].merge({ id: Current.family.id })
|
||||
user_params_with_family[:family_attributes] = family_attributes
|
||||
end
|
||||
|
||||
if Current.user.update(user_params_with_family)
|
||||
redirect_to root_path, notice: "Profile updated successfully."
|
||||
redirect_to settings_profile_path, notice: t(".success")
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
|
@ -20,7 +20,7 @@ class Settings::ProfilesController < ApplicationController
|
|||
private
|
||||
|
||||
def user_params
|
||||
params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation,
|
||||
family_attributes: [ :name, :id, :currency ])
|
||||
params.require(:user).permit(:first_name, :last_name,
|
||||
family_attributes: [ :name, :id ])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue