Class: CompletionKit::DatasetsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- CompletionKit::DatasetsController
- Defined in:
- app/controllers/completion_kit/datasets_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ 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/completion_kit/datasets_controller.rb', line 20 def create @dataset = Dataset.new(dataset_params) if @dataset.save redirect_to datasets_path, notice: "Dataset was successfully created." else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
38 39 40 41 |
# File 'app/controllers/completion_kit/datasets_controller.rb', line 38 def destroy @dataset.destroy redirect_to datasets_path, notice: "Dataset was successfully destroyed." end |
#edit ⇒ Object
17 18 |
# File 'app/controllers/completion_kit/datasets_controller.rb', line 17 def edit end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/completion_kit/datasets_controller.rb', line 5 def index @datasets = Dataset.includes(:runs).order(created_at: :desc) end |
#new ⇒ Object
13 14 15 |
# File 'app/controllers/completion_kit/datasets_controller.rb', line 13 def new @dataset = Dataset.new end |
#show ⇒ Object
9 10 11 |
# File 'app/controllers/completion_kit/datasets_controller.rb', line 9 def show @runs = @dataset.runs.includes(:prompt, :responses).order(created_at: :desc) end |
#update ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/controllers/completion_kit/datasets_controller.rb', line 30 def update if @dataset.update(dataset_params) redirect_to @dataset, notice: "Dataset was successfully updated." else render :edit, status: :unprocessable_entity end end |