Class: RcrewAI::Rails::ToolsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/rcrewai/rails/tools_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
# File 'app/controllers/rcrewai/rails/tools_controller.rb', line 18

def create
  @tool = @agent.tools.build(tool_params)
  
  if @tool.save
    redirect_to [@agent, @tool], notice: 'Tool was successfully created.'
  else
    render :new
  end
end

#destroyObject



39
40
41
42
# File 'app/controllers/rcrewai/rails/tools_controller.rb', line 39

def destroy
  @tool.destroy
  redirect_to @agent, notice: 'Tool was successfully deleted.'
end

#editObject



28
29
# File 'app/controllers/rcrewai/rails/tools_controller.rb', line 28

def edit
end

#indexObject



7
8
9
# File 'app/controllers/rcrewai/rails/tools_controller.rb', line 7

def index
  @tools = @agent.tools
end

#newObject



14
15
16
# File 'app/controllers/rcrewai/rails/tools_controller.rb', line 14

def new
  @tool = @agent.tools.build
end

#showObject



11
12
# File 'app/controllers/rcrewai/rails/tools_controller.rb', line 11

def show
end

#updateObject



31
32
33
34
35
36
37
# File 'app/controllers/rcrewai/rails/tools_controller.rb', line 31

def update
  if @tool.update(tool_params)
    redirect_to [@agent, @tool], notice: 'Tool was successfully updated.'
  else
    render :edit
  end
end