Class: FunctionsController
Instance Method Summary
collapse
#check_route, #current_ability, #set_current_user
Instance Method Details
#create ⇒ Object
12
13
14
15
16
17
18
19
20
21
|
# File 'app/controllers/functions_controller.rb', line 12
def create
@function = Function.new(function_params)
respond_to do |format|
if @function.save
format.html{ redirect_to functions_path }
else
format.html{ render :new }
end
end
end
|
#destroy ⇒ Object
36
37
38
39
40
41
|
# File 'app/controllers/functions_controller.rb', line 36
def destroy
respond_to do |format|
@function.destroy
format.html{ redirect_to functions_path }
end
end
|
#edit ⇒ Object
23
24
|
# File 'app/controllers/functions_controller.rb', line 23
def edit
end
|
#index ⇒ Object
4
5
6
|
# File 'app/controllers/functions_controller.rb', line 4
def index
@functions = Function.all
end
|
#new ⇒ Object
8
9
10
|
# File 'app/controllers/functions_controller.rb', line 8
def new
@function = Function.new
end
|
#setting_handle ⇒ Object
48
49
50
51
52
53
54
|
# File 'app/controllers/functions_controller.rb', line 48
def setting_handle
@function.routepaths.update_all(function_id: nil)
Routepath.where(id: params[:routepath_id]).update_all(function_id: @function.id)
respond_to do |format|
format.html{ redirect_to functions_path }
end
end
|
#setting_routes ⇒ Object
43
44
45
46
|
# File 'app/controllers/functions_controller.rb', line 43
def setting_routes
@routes = Routepath.order(:controller)
@funcRoutes = @function.routepaths
end
|
#update ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/functions_controller.rb', line 26
def update
respond_to do |format|
if @function.update(function_params)
format.html{ redirect_to functions_path }
else
format.html{ render :edit }
end
end
end
|