Class: Teamable::AccountsController
- Inherits:
-
TeamableController
- Object
- TeamableController
- Teamable::AccountsController
- Defined in:
- app/controllers/teamable/accounts_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /account.
-
#new ⇒ Object
GET /account/new.
- #switch ⇒ Object
Instance Method Details
#create ⇒ Object
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_params) @account.members.build(user: current_user) if @account.save redirect_to root_path(account_id: @account) else render :new, status: :unprocessable_entity end end |
#new ⇒ Object
GET /account/new
8 9 10 |
# File 'app/controllers/teamable/accounts_controller.rb', line 8 def new @account = current_user.accounts.new end |
#switch ⇒ Object
24 25 26 27 |
# File 'app/controllers/teamable/accounts_controller.rb', line 24 def switch account = current_user.accounts.find_puid!(params[:account_id]) redirect_to after_account_switched_path(account) end |