Class: FunctionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/functions_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#check_route, #current_ability, #set_current_user

Instance Method Details

#createObject



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

#destroyObject



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

#editObject



23
24
# File 'app/controllers/functions_controller.rb', line 23

def edit
end

#indexObject



4
5
6
# File 'app/controllers/functions_controller.rb', line 4

def index
  @functions = Function.all
end

#newObject



8
9
10
# File 'app/controllers/functions_controller.rb', line 8

def new
  @function = Function.new
end

#setting_handleObject



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_routesObject



43
44
45
46
# File 'app/controllers/functions_controller.rb', line 43

def setting_routes
  @routes = Routepath.order(:controller)
  @funcRoutes = @function.routepaths
end

#updateObject



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