Class: Kiqr::Users::Settings::AccountsController
- Inherits:
-
BaseController
- Object
- BaseController
- Kiqr::Users::Settings::AccountsController
- Defined in:
- app/controllers/kiqr/users/settings/accounts_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/kiqr/users/settings/accounts_controller.rb', line 13 def create @account = Account.new(account_params) # Link the current user to the account as the owner @account.members.new(user: current_user, owner: true) if @account.save :success, :account_created redirect_to dashboard_path(account_id: @account) else render :new, status: :unprocessable_content end end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/kiqr/users/settings/accounts_controller.rb', line 5 def index @memberships = current_user.members.includes(:account).references(:account) end |
#new ⇒ Object
9 10 11 |
# File 'app/controllers/kiqr/users/settings/accounts_controller.rb', line 9 def new @account = Account.new end |