Class: MrCommon::PreRegistrations::PreRegistrationsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/mr_common/pre_registrations/pre_registrations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/mr_common/pre_registrations/pre_registrations_controller.rb', line 14

def create
  @pre_registration = PreRegistration.new(pre_registration_params)

  if @pre_registration.save
    redirect_to pre_registrations_path, notice: "Pre-registration saved."
  else
    flash.now[:alert] = "There was a problem saving the pre-registration."
    render :new, status: :unprocessable_entity
  end
end

#destroyObject



25
26
27
28
29
30
31
32
33
# File 'app/controllers/mr_common/pre_registrations/pre_registrations_controller.rb', line 25

def destroy
  @pre_registration = PreRegistration.find(params[:id])

  if @pre_registration.destroy
    redirect_to pre_registrations_path, notice: "Pre-registration deleted."
  else
    redirect_to pre_registrations_path, notice: "There was a problem deleting the pre-registration."
  end
end

#indexObject



6
7
8
# File 'app/controllers/mr_common/pre_registrations/pre_registrations_controller.rb', line 6

def index
  @pre_registration = PreRegistration.order(email: :asc)
end

#newObject



10
11
12
# File 'app/controllers/mr_common/pre_registrations/pre_registrations_controller.rb', line 10

def new
  @pre_registration = PreRegistration.new
end