mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 15:49:39 +02:00
New Settings Menu, Routes and Controllers Organization (#641)
* Add new settings routes and controllers * Add new settings view, restructure controllers and routes * Fix lint errors
This commit is contained in:
parent
39d57a167e
commit
9bda7efc3f
52 changed files with 771 additions and 203 deletions
26
app/controllers/settings/profiles_controller.rb
Normal file
26
app/controllers/settings/profiles_controller.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
class Settings::ProfilesController < ApplicationController
|
||||
def show
|
||||
end
|
||||
|
||||
def update
|
||||
user_params_with_family = user_params
|
||||
|
||||
if Current.family
|
||||
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."
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def user_params
|
||||
params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation,
|
||||
family_attributes: [ :name, :id, :currency ])
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue