Class: Spina::Admin::Conferences::DietaryRequirementsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/spina/admin/conferences/dietary_requirements_controller.rb

Overview

Controller for DietaryRequirement objects.

See Also:

Actions collapse

Instance Method Details

#createvoid

This method returns an undefined value.

Creates a dietary requirement.



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/controllers/spina/admin/conferences/dietary_requirements_controller.rb', line 36

def create # rubocop:disable Metrics/MethodLength
  @dietary_requirement = DietaryRequirement.new dietary_requirement_params

  if @dietary_requirement.save
    redirect_to admin_conferences_dietary_requirements_path, success: t('.saved')
  else
    respond_to do |format|
      format.html do
        add_breadcrumb t('.new')
        render :new
      end
      format.js { render partial: 'errors', locals: { errors: @dietary_requirement.errors } }
    end
  end
end

#destroyvoid

This method returns an undefined value.

Destroys a dietary requirement.



70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'app/controllers/spina/admin/conferences/dietary_requirements_controller.rb', line 70

def destroy # rubocop:disable Metrics/MethodLength
  if @dietary_requirement.destroy
    redirect_to admin_conferences_dietary_requirements_path, success: t('.destroyed')
  else
    respond_to do |format|
      format.html do
        add_breadcrumb @dietary_requirement.name
        render :edit
      end
      format.js { render partial: 'errors', locals: { errors: @dietary_requirement.errors } }
    end
  end
end

#editvoid

This method returns an undefined value.

Renders a form for an existing dietary requirement.



30
31
32
# File 'app/controllers/spina/admin/conferences/dietary_requirements_controller.rb', line 30

def edit
  add_breadcrumb @dietary_requirement.name
end

#indexvoid

This method returns an undefined value.

Renders a list of dietary requirements.



17
18
19
# File 'app/controllers/spina/admin/conferences/dietary_requirements_controller.rb', line 17

def index
  @dietary_requirements = DietaryRequirement.sorted
end

#newvoid

This method returns an undefined value.

Renders a form for a new dietary requirement.



23
24
25
26
# File 'app/controllers/spina/admin/conferences/dietary_requirements_controller.rb', line 23

def new
  @dietary_requirement = DietaryRequirement.new
  add_breadcrumb t('.new')
end

#updatevoid

This method returns an undefined value.

Updates a dietary requirement.



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'app/controllers/spina/admin/conferences/dietary_requirements_controller.rb', line 54

def update # rubocop:disable Metrics/MethodLength
  if @dietary_requirement.update(dietary_requirement_params)
    redirect_to admin_conferences_dietary_requirements_path, success: t('.saved')
  else
    respond_to do |format|
      format.html do
        add_breadcrumb @dietary_requirement.name
        render :edit
      end
      format.js { render partial: 'errors', locals: { errors: @dietary_requirement.errors } }
    end
  end
end