Class: Spina::Admin::Conferences::InstitutionsController
- Inherits:
-
ApplicationController
- Object
- AdminController
- ApplicationController
- Spina::Admin::Conferences::InstitutionsController
- Defined in:
- app/controllers/spina/admin/conferences/institutions_controller.rb
Overview
Controller for Institution objects.
Actions collapse
-
#create ⇒ void
Creates an institution.
-
#destroy ⇒ void
Destroys an institution.
-
#edit ⇒ void
Renders a form for an existing institution.
-
#index ⇒ void
Renders a list of institutions.
-
#new ⇒ void
Renders a form for a new institution.
-
#update ⇒ void
Updates an institution.
Instance Method Details
#create ⇒ void
This method returns an undefined value.
Creates an institution.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/spina/admin/conferences/institutions_controller.rb', line 36 def create # rubocop:disable Metrics/MethodLength @institution = Institution.new(conference_params) if @institution.save redirect_to admin_conferences_institutions_path, success: t('.saved') else respond_to do |format| format.html do t('.new') render :new end format.turbo_stream { render partial: 'errors', locals: { errors: @institution.errors } } end end end |
#destroy ⇒ void
This method returns an undefined value.
Destroys an institution.
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'app/controllers/spina/admin/conferences/institutions_controller.rb', line 70 def destroy # rubocop:disable Metrics/MethodLength if @institution.destroy redirect_to admin_conferences_institutions_path, success: t('.destroyed') else respond_to do |format| format.html do @institution.name render :edit end format.turbo_stream { render partial: 'errors', locals: { errors: @institution.errors } } end end end |
#edit ⇒ void
This method returns an undefined value.
Renders a form for an existing institution.
30 31 32 |
# File 'app/controllers/spina/admin/conferences/institutions_controller.rb', line 30 def edit @institution.name end |
#index ⇒ void
This method returns an undefined value.
Renders a list of institutions.
17 18 19 |
# File 'app/controllers/spina/admin/conferences/institutions_controller.rb', line 17 def index @institutions = Institution.sorted.page(params[:page]) end |
#new ⇒ void
This method returns an undefined value.
Renders a form for a new institution.
23 24 25 26 |
# File 'app/controllers/spina/admin/conferences/institutions_controller.rb', line 23 def new @institution = Institution.new t('.new') end |
#update ⇒ void
This method returns an undefined value.
Updates an institution.
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/controllers/spina/admin/conferences/institutions_controller.rb', line 54 def update # rubocop:disable Metrics/MethodLength if @institution.update(conference_params) redirect_to admin_conferences_institutions_path, success: t('.saved') else respond_to do |format| format.html do @institution.name render :edit end format.turbo_stream { render partial: 'errors', locals: { errors: @institution.errors } } end end end |