mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-22 22:59:39 +02:00
* Add basic date and time localization * Normalize translations * Localize transaction dates * Removed unsupported Rails locales
26 lines
788 B
Ruby
26 lines
788 B
Ruby
class Settings::PreferencesController < SettingsController
|
|
def edit
|
|
end
|
|
|
|
def update
|
|
preference_params_with_family = preference_params
|
|
|
|
if Current.family && preference_params[:family_attributes]
|
|
family_attributes = preference_params[:family_attributes].merge({ id: Current.family.id })
|
|
preference_params_with_family[:family_attributes] = family_attributes
|
|
end
|
|
|
|
if Current.user.update(preference_params_with_family)
|
|
redirect_to settings_preferences_path, notice: t(".success")
|
|
else
|
|
redirect_to settings_preferences_path, notice: t(".success")
|
|
render :show, status: :unprocessable_entity
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def preference_params
|
|
params.require(:user).permit(family_attributes: [ :id, :currency, :locale ])
|
|
end
|
|
end
|