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