Class: Leva::DatasetsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Leva::DatasetsController
- Defined in:
- app/controllers/leva/datasets_controller.rb
Instance Method Summary collapse
-
#create ⇒ void
POST /datasets.
-
#destroy ⇒ void
DELETE /datasets/1.
-
#edit ⇒ void
GET /datasets/1/edit.
-
#index ⇒ void
GET /datasets.
-
#new ⇒ void
GET /datasets/new.
-
#show ⇒ void
GET /datasets/1.
-
#update ⇒ void
PATCH/PUT /datasets/1.
Instance Method Details
#create ⇒ void
This method returns an undefined value.
POST /datasets
34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/leva/datasets_controller.rb', line 34 def create @dataset = Dataset.new(dataset_params) if @dataset.save redirect_to @dataset, notice: 'Dataset was successfully created.' else render :new end end |
#destroy ⇒ void
This method returns an undefined value.
DELETE /datasets/1
56 57 58 59 60 61 62 63 |
# File 'app/controllers/leva/datasets_controller.rb', line 56 def destroy if @dataset.dataset_records.any? redirect_to @dataset, alert: 'Cannot delete dataset with existing records.' else @dataset.destroy redirect_to datasets_url, notice: 'Dataset was successfully destroyed.' end end |
#edit ⇒ void
This method returns an undefined value.
GET /datasets/1/edit
28 29 30 |
# File 'app/controllers/leva/datasets_controller.rb', line 28 def edit # The @dataset is already set by the before_action end |
#index ⇒ void
This method returns an undefined value.
GET /datasets
9 10 11 |
# File 'app/controllers/leva/datasets_controller.rb', line 9 def index @datasets = Dataset.all end |
#new ⇒ void
This method returns an undefined value.
GET /datasets/new
22 23 24 |
# File 'app/controllers/leva/datasets_controller.rb', line 22 def new @dataset = Dataset.new end |
#show ⇒ void
This method returns an undefined value.
GET /datasets/1
15 16 17 18 |
# File 'app/controllers/leva/datasets_controller.rb', line 15 def show @experiments = @dataset.experiments @new_experiment = Experiment.new(dataset: @dataset) end |
#update ⇒ void
This method returns an undefined value.
PATCH/PUT /datasets/1
46 47 48 49 50 51 52 |
# File 'app/controllers/leva/datasets_controller.rb', line 46 def update if @dataset.update(dataset_params) redirect_to @dataset, notice: 'Dataset was successfully updated.' else render :edit end end |