blob: 3b44d087cf9e4be91227f67b78be0a1cf39daba9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
class LineFootnotesController < ChouetteController
defaults :resource_class => Chouette::Line, :instance_name => 'line'
before_action :check_policy, only: [:edit, :update, :destroy]
belongs_to :referential
def show
show! do
build_breadcrumb :show
end
end
def edit
edit! do
build_breadcrumb :edit
end
end
def update
if @line.update(line_params)
redirect_to referential_line_footnotes_path(@referential, @line) , notice: t('notice.footnotes.updated')
else
render :edit
end
end
protected
def check_policy
authorize resource, "#{action_name}_footnote?".to_sym
end
private
def resource
@referential = Referential.find params[:referential_id]
@line = @referential.lines.find params[:line_id]
end
def line_params
params.require(:line).permit(
{ footnotes_attributes: [ :code, :label, :_destroy, :id ] } )
end
end
|