Class: MrCommon::Registrations::RegistrationsController
- Inherits:
-
BaseController
- Object
- BaseController
- MrCommon::Registrations::RegistrationsController
- Defined in:
- app/controllers/mr_common/registrations/registrations_controller.rb
Overview
Admin CRUD for Registrations.
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/mr_common/registrations/registrations_controller.rb', line 19 def create @registration = Registration.new(registration_params) if @registration.save redirect_to registrations_path, notice: "Registration saved." else flash.now[:alert] = MrCommon.registration_failure_alert render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/mr_common/registrations/registrations_controller.rb', line 45 def destroy @registration = Registration.find(params[:id]) if @registration.destroy redirect_to registrations_path, notice: "Registration destroyed." else redirect_to @registration, alert: "Unable to destroy Registration." end end |
#edit ⇒ Object
30 31 32 |
# File 'app/controllers/mr_common/registrations/registrations_controller.rb', line 30 def edit @registration = Registration.find(params[:id]) end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/mr_common/registrations/registrations_controller.rb', line 7 def index @registrations = Registration.order(first_name: :asc, last_name: :asc) end |
#new ⇒ Object
15 16 17 |
# File 'app/controllers/mr_common/registrations/registrations_controller.rb', line 15 def new @registration = Registration.new end |
#show ⇒ Object
11 12 13 |
# File 'app/controllers/mr_common/registrations/registrations_controller.rb', line 11 def show @registration = Registration.find(params[:id]) end |
#update ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/mr_common/registrations/registrations_controller.rb', line 34 def update @registration = Registration.find(params[:id]) if @registration.update(registration_params) redirect_to @registration, notice: "Registration saved." else flash.now[:alert] = MrCommon.registration_failure_alert render :new, status: :unprocessable_entity end end |