Class: MrCommon::Registrations::RegistrationsController
- Inherits:
-
BaseController
- Object
- BaseController
- MrCommon::Registrations::RegistrationsController
- Defined in:
- app/controllers/mr_common/registrations/registrations_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/mr_common/registrations/registrations_controller.rb', line 18 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
44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/mr_common/registrations/registrations_controller.rb', line 44 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
29 30 31 |
# File 'app/controllers/mr_common/registrations/registrations_controller.rb', line 29 def edit @registration = Registration.find(params[:id]) end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/mr_common/registrations/registrations_controller.rb', line 6 def index @registrations = Registration.order(first_name: :asc, last_name: :asc) end |
#new ⇒ Object
14 15 16 |
# File 'app/controllers/mr_common/registrations/registrations_controller.rb', line 14 def new @registration = Registration.new end |
#show ⇒ Object
10 11 12 |
# File 'app/controllers/mr_common/registrations/registrations_controller.rb', line 10 def show @registration = Registration.find(params[:id]) end |
#update ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/mr_common/registrations/registrations_controller.rb', line 33 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 |