Class: RcrewAI::Rails::CrewsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RcrewAI::Rails::CrewsController
- Defined in:
- app/controllers/rcrewai/rails/crews_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #execute ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/rcrewai/rails/crews_controller.rb', line 20 def create @crew = Crew.new(crew_params) if @crew.save redirect_to @crew, notice: 'Crew was successfully created.' else render :new end end |
#destroy ⇒ Object
41 42 43 44 |
# File 'app/controllers/rcrewai/rails/crews_controller.rb', line 41 def destroy @crew.destroy redirect_to crews_url, notice: 'Crew was successfully destroyed.' end |
#edit ⇒ Object
30 31 |
# File 'app/controllers/rcrewai/rails/crews_controller.rb', line 30 def edit end |
#execute ⇒ Object
46 47 48 49 50 51 |
# File 'app/controllers/rcrewai/rails/crews_controller.rb', line 46 def execute inputs = params[:inputs] || {} execution = @crew.execute_async(inputs) redirect_to execution_path(execution), notice: 'Crew execution started.' end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/rcrewai/rails/crews_controller.rb', line 6 def index @crews = Crew.includes(:agents, :tasks).all end |
#new ⇒ Object
16 17 18 |
# File 'app/controllers/rcrewai/rails/crews_controller.rb', line 16 def new @crew = Crew.new end |
#show ⇒ Object
10 11 12 13 14 |
# File 'app/controllers/rcrewai/rails/crews_controller.rb', line 10 def show @recent_executions = @crew.executions.recent.limit(10) @agents = @crew.agents @tasks = @crew.tasks.ordered end |
#update ⇒ Object
33 34 35 36 37 38 39 |
# File 'app/controllers/rcrewai/rails/crews_controller.rb', line 33 def update if @crew.update(crew_params) redirect_to @crew, notice: 'Crew was successfully updated.' else render :edit end end |