Class: Teamable::SetupController

Inherits:
TeamableController show all
Defined in:
app/controllers/teamable/setup_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /account/setup



13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/teamable/setup_controller.rb', line 13

def create
  @account = current_user.()
  @account. = true
  @account.members.build(user: current_user)

  if @account.save
    current_user.update(personal_account: @account)
    redirect_to root_path, notice: "Your account was setup successfully!"
  else
    render :new, status: :unprocessable_entity
  end
end

#newObject

GET /account/setup



6
7
8
9
10
# File 'app/controllers/teamable/setup_controller.rb', line 6

def new
  @account = current_user.(
    personal_account: true
  )
end