Module: Account::Onboarding::UserDetails::ControllerBase
- Extended by:
- ActiveSupport::Concern
- Included in:
- Account::Onboarding::UserDetailsController
- Defined in:
- app/controllers/concerns/account/onboarding/user_details/controller_base.rb
Instance Method Summary collapse
-
#edit ⇒ Object
GET /users/1/edit.
-
#update ⇒ Object
PATCH/PUT /users/1 PATCH/PUT /users/1.json.
Instance Method Details
#edit ⇒ Object
GET /users/1/edit
15 16 17 |
# File 'app/controllers/concerns/account/onboarding/user_details/controller_base.rb', line 15 def edit flash[:notice] = nil end |
#update ⇒ Object
PATCH/PUT /users/1 PATCH/PUT /users/1.json
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/concerns/account/onboarding/user_details/controller_base.rb', line 21 def update respond_to do |format| if @user.update(user_params) # if you update your own user account, devise will normally kick you out, so we do this instead. bypass_sign_in current_user.reload # Only redirect users to the bulk invitation page if they're the # one who created the team (meaning there's only one membership on the team). if @user.details_provided? if bulk_invitations_enabled? && @user.teams.first.memberships.size == 1 format.html { redirect_to new_account_onboarding_invitation_list_path(@user) } else format.html { redirect_to account_team_path(@user.teams.first), notice: "" } end else format.html { flash[:error] = I18n.t("global.notifications.all_fields_required") redirect_to edit_account_onboarding_user_detail_path(@user) } end format.json { render :show, status: :ok, location: [:account, @user] } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @user.errors, status: :unprocessable_entity } end end end |