Class: CompletionKit::SuggestionsController

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

Instance Method Summary collapse

Instance Method Details

#applyObject



10
11
12
13
14
15
16
# File 'app/controllers/completion_kit/suggestions_controller.rb', line 10

def apply
  run = @suggestion.run
  new_prompt = run.prompt.clone_as_new_version(template: @suggestion.suggested_template)
  new_prompt.publish!
  @suggestion.update!(applied_at: Time.current)
  redirect_to prompt_path(new_prompt), notice: "Suggestion applied."
end

#showObject



5
6
7
8
# File 'app/controllers/completion_kit/suggestions_controller.rb', line 5

def show
  @run = @suggestion.run
  @from = params[:from] == "run" ? "run" : "prompt"
end