Class: EgovUtils::RegistrationRequestsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/egov_utils/registration_requests_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/egov_utils/registration_requests_controller.rb', line 17

def create
  @registration_request = RegistrationRequests::Create.run(create_params)
  if @registration_request.valid?
    redirect_to egov_utils.new_session_path,
                notice: I18n.t('registration_request.create.success')
  else
    puts @registration_request.errors.inspect
    render :new
  end
end

#indexObject



6
7
8
9
# File 'app/controllers/egov_utils/registration_requests_controller.rb', line 6

def index
  @registration_requests =
    RegistrationRequest.order(created_at: :desc).page(params[:page] || 1)
end

#newObject



13
14
15
# File 'app/controllers/egov_utils/registration_requests_controller.rb', line 13

def new
  @registration_request = RegistrationRequests::Create.new
end

#showObject



11
# File 'app/controllers/egov_utils/registration_requests_controller.rb', line 11

def show; end

#updateObject



28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/egov_utils/registration_requests_controller.rb', line 28

def update
  RegistrationRequests::HandleRequest.run!(
    update_params.merge(registration_request: @registration_request)
  )

  if @registration_request.valid?
    redirect_to @registration_request,
                notice: I18n.t('registration_request.update.success')
  else
    render :show
  end
end