Class: OpenStax::Accounts::Dev::AccountsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- ApplicationController
- BaseController
- OpenStax::Accounts::Dev::AccountsController
- Defined in:
- app/controllers/openstax/accounts/dev/accounts_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#become ⇒ Object
27 28 29 30 31 |
# File 'app/controllers/openstax/accounts/dev/accounts_controller.rb', line 27 def become @account = Account.find(params[:id]) sign_in @account redirect_back key: :accounts_return_to, strategies: [:session] end |
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/openstax/accounts/dev/accounts_controller.rb', line 12 def create handle_with( AccountsCreate, success: -> do username = @handler_result.outputs.account.username flash.notice = "Account with username \"#{username}\" created." redirect_to dev_accounts_path(search: { query: username }) end, failure: -> do flash.alert = @handler_result.errors.first.translate redirect_to dev_accounts_path(search: { query: params.dig(:create, :username) }) end ) end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/openstax/accounts/dev/accounts_controller.rb', line 8 def index handle_with AccountsSearch end |