Sha256: 45711a9f2db24ab75c129b51758c7c934672d902ce05e0e1e189d676276b402e

Contents?: true

Size: 669 Bytes

Versions: 2

Compression:

Stored size: 669 Bytes

Contents

class SignUpsController::Create < BaseAction
  def perform
    return view_builder.build(Todos::IndexRedirect) if current_user
    return view_builder.build(Defaults::BadRequestView, errors: [user_params.error_message]) unless user_params.fetch

    if create_user_result.success?
      SignInService.perform!(session, create_user_result.user)
      view_builder.build(Todos::IndexRedirect)
    else
      view_builder.build(SignUps::NewView)
    end
  end

  private

  def create_user_result
    @create_user_result ||= CreateUserService.perform(user_params.fetch)
  end

  def user_params
    @user_params ||= ::SignUpsController::UserParams.build(params)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aldous-1.1.3 examples/basic_todo/app/controller_actions/sign_ups_controller/create.rb
aldous-1.1.2 examples/basic_todo/app/controller_actions/sign_ups_controller/create.rb