Class: Teamable::AccountsController

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

Instance Method Summary collapse

Instance Method Details

#createObject

POST /account



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

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

  if @account.save
    redirect_to root_path(account_id: @account)
  else
    render :new, status: :unprocessable_entity
  end
end

#newObject

GET /account/new



8
9
10
# File 'app/controllers/teamable/accounts_controller.rb', line 8

def new
  @account = current_user.accounts.new
end

#switchObject



24
25
26
27
# File 'app/controllers/teamable/accounts_controller.rb', line 24

def switch
   = current_user.accounts.find_puid!(params[:account_id])
  redirect_to ()
end