Class: SplitCat::ExperimentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- SplitCat::ExperimentsController
- Defined in:
- app/controllers/split_cat/experiments_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /experiments.
-
#destroy ⇒ Object
DELETE /experiments/1.
-
#edit ⇒ Object
GET /experiments/1/edit.
-
#index ⇒ Object
GET /experiments.
-
#new ⇒ Object
GET /experiments/new.
-
#show ⇒ Object
GET /experiments/1.
-
#update ⇒ Object
PATCH/PUT /experiments/1.
Instance Method Details
#create ⇒ Object
POST /experiments
32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/split_cat/experiments_controller.rb', line 32 def create @experiment = Experiment.new(experiment_params) if @experiment.save redirect_to @experiment, notice: 'Experiment was successfully created.' else render action: 'new' end end |
#destroy ⇒ Object
DELETE /experiments/1
52 53 54 55 |
# File 'app/controllers/split_cat/experiments_controller.rb', line 52 def destroy @experiment.destroy redirect_to experiments_url, notice: 'Experiment was successfully destroyed.' end |
#edit ⇒ Object
GET /experiments/1/edit
28 29 |
# File 'app/controllers/split_cat/experiments_controller.rb', line 28 def edit end |
#index ⇒ Object
GET /experiments
6 7 8 9 10 11 12 |
# File 'app/controllers/split_cat/experiments_controller.rb', line 6 def index @name = params[ :name ] @active = ( params[ :active ] == '1' ) @experiments = Experiment.order( 'id desc' ) @experiments = @experiments.where( 'name like ?', '%' + @name + '%') if @name end |
#new ⇒ Object
GET /experiments/new
23 24 25 |
# File 'app/controllers/split_cat/experiments_controller.rb', line 23 def new @experiment = Experiment.new end |
#show ⇒ Object
GET /experiments/1
15 16 17 18 19 20 |
# File 'app/controllers/split_cat/experiments_controller.rb', line 15 def show respond_to do |format| format.html format.csv { render :text => @experiment.to_csv, :content_type => 'text/csv' } end end |
#update ⇒ Object
PATCH/PUT /experiments/1
43 44 45 46 47 48 49 |
# File 'app/controllers/split_cat/experiments_controller.rb', line 43 def update if @experiment.update(experiment_params) redirect_to @experiment, notice: 'Experiment was successfully updated.' else render action: 'edit' end end |