Sha256: cce9a4caff74d445f96b188cc0c4d6d722fa009e22b0c189cbd6cbade609319d

Contents?: true

Size: 637 Bytes

Versions: 2

Compression:

Stored size: 637 Bytes

Contents

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

    if create_user_result.success?
      SignInService.perform!(session, create_user_result.user)
      build_view(Todos::IndexRedirect)
    else
      build_view(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.0.1 examples/basic_todo/app/controller_actions/sign_ups_controller/create.rb
aldous-1.0.0 examples/basic_todo/app/controller_actions/sign_ups_controller/create.rb