Sha256: ab06885bed8141357695e0c867bad1500a42ae1b7eea14a65fab7e19866282e8

Contents?: true

Size: 1.07 KB

Versions: 57

Compression:

Stored size: 1.07 KB

Contents

class TestsController < ApplicationController
  before_action :set_test, only: [:show, :edit, :update, :destroy]

  # GET /tests
  def index
    @tests = Test.all.page 1
  end

  # GET /tests/1
  def show
  end

  # GET /tests/new
  def new
    @test = Test.new
  end

  # GET /tests/1/edit
  def edit
  end

  # POST /tests
  def create
    @test = Test.new(test_params)

    if @test.save
      redirect_to @test, notice: 'Test was successfully created.'
    else
      render :new
    end
  end

  # PATCH/PUT /tests/1
  def update
    if @test.update(test_params)
      redirect_to @test, notice: 'Test was successfully updated.'
    else
      render :edit
    end
  end

  # DELETE /tests/1
  def destroy
    @test.destroy
    redirect_to tests_url, notice: 'Test was successfully destroyed.'
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_test
      @test = Test.find(params[:id])
    end

    # Only allow a trusted parameter "white list" through.
    def test_params
      params.require(:test).permit(:price, :name)
    end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
wordjelly-auth-1.6.0 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.5.9 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.5.8 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.5.7 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.5.6 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.5.5 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.5.4 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.5.3 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.5.2 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.5.1 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.5.0 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.4.9 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.4.8 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.4.7 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.4.6 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.4.5 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.4.4 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.4.3 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.4.2 spec/dummy/app/controllers/tests_controller.rb
wordjelly-auth-1.4.0 spec/dummy/app/controllers/tests_controller.rb