Module: Account::Onboarding::InvitationLists::ControllerBase

Extended by:
ActiveSupport::Concern
Included in:
Account::Onboarding::InvitationListsController
Defined in:
app/controllers/concerns/account/onboarding/invitation_lists/controller_base.rb

Instance Method Summary collapse

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/concerns/account/onboarding/invitation_lists/controller_base.rb', line 17

def create
  @account_onboarding_invitation_list = Account::Onboarding::InvitationList.new()

  # Set default values for invitations and memberships.
  # `save` below checks if the values are valid or not.
  @account_onboarding_invitation_list.team = current_team
  @account_onboarding_invitation_list.invitations.each_with_index do |invitation, idx|
    invitation.team = current_team
    invitation.from_membership = current_membership
    invitation.membership.team = current_team
    invitation.membership.user_email = invitation.email
  end

  respond_to do |format|
    if @account_onboarding_invitation_list.save
      format.html { redirect_to (@user.teams.first), notice: "" }
      format.json { render :show, status: :ok, location: [:account, @user] }
    else
      format.html { render :new, status: :unprocessable_entity }
      format.json { render json: @account_onboarding_invitation_list.errors, status: :unprocessable_entity }
    end
  end
end

#newObject



13
14
15
# File 'app/controllers/concerns/account/onboarding/invitation_lists/controller_base.rb', line 13

def new
  @account_onboarding_invitation_list = Account::Onboarding::InvitationList.new
end