Class: Renalware::Modalities::DescriptionsController

Inherits:
BaseController show all
Defined in:
app/controllers/renalware/modalities/descriptions_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#patient

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/renalware/modalities/descriptions_controller.rb', line 14

def create
  modality_description = Description.new(modality_description_params)
  authorize modality_description

  if modality_description.save
    redirect_to modalities_descriptions_path,
                notice: t(".success", model_name: "modality description")
  else
    flash.now[:error] = t(".failed", model_name: "modality description")
    render_new(modality_description)
  end
end

#destroyObject



48
49
50
51
52
# File 'app/controllers/renalware/modalities/descriptions_controller.rb', line 48

def destroy
  authorize Description.destroy(params[:id])
  redirect_to modalities_descriptions_path,
              notice: t(".success", model_name: "modality description")
end

#editObject



33
34
35
# File 'app/controllers/renalware/modalities/descriptions_controller.rb', line 33

def edit
  render_edit(find_and_authorize_modality_description)
end

#indexObject



27
28
29
30
31
# File 'app/controllers/renalware/modalities/descriptions_controller.rb', line 27

def index
  modality_descriptions = Description.all
  authorize modality_descriptions
  render locals: { modality_descriptions: modality_descriptions }
end

#newObject



8
9
10
11
12
# File 'app/controllers/renalware/modalities/descriptions_controller.rb', line 8

def new
  modality_description = Description.new
  authorize modality_description
  render_new(modality_description)
end

#updateObject



37
38
39
40
41
42
43
44
45
46
# File 'app/controllers/renalware/modalities/descriptions_controller.rb', line 37

def update
  modality_description = find_and_authorize_modality_description
  if modality_description.update(modality_description_params)
    redirect_to modalities_descriptions_path,
                notice: t(".success", model_name: "modality description")
  else
    flash.now[:error] = t(".failed", model_name: "modality description")
    render_edit(modality_description)
  end
end