Sha256: 8ad1a113db36cb6e7a27bcb419d8baeffc232793853a7bfb4050bba9b583df18

Contents?: true

Size: 1.14 KB

Versions: 7

Compression:

Stored size: 1.14 KB

Contents

class MakersController < ApplicationController
  before_action :set_maker, only: [:show, :edit, :update, :destroy]

  autocomplete product: :name, maker: [:name_ja, :name_en]

  # GET /makers
  def index
    @makers = Maker.all
  end

  # GET /makers/1
  def show
  end

  # GET /makers/new
  def new
    @maker = Maker.new
  end

  # GET /makers/1/edit
  def edit
  end

  # POST /makers
  def create
    @maker = Maker.new(maker_params)

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

  # PATCH/PUT /makers/1
  def update
    if @maker.update(maker_params)
      redirect_to @maker, notice: 'Maker was successfully updated.'
    else
      render :edit
    end
  end

  # DELETE /makers/1
  def destroy
    @maker.destroy
    redirect_to makers_url, notice: 'Maker was successfully destroyed.'
  end

  private

  # Use callbacks to share common setup or constraints between actions.
  def set_maker
    @maker = Maker.find(params[:id])
  end

  # Only allow a trusted parameter "white list" through.
  def maker_params
    params.require(:maker).permit(:name_ja, :name_en)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
autocompl-0.2.2 test/dummy/app/controllers/makers_controller.rb
autocompl-0.2.1 test/dummy/app/controllers/makers_controller.rb
autocompl-0.2.0 test/dummy/app/controllers/makers_controller.rb
autocompl-0.1.2 test/dummy/app/controllers/makers_controller.rb
autocompl-0.1.1 test/dummy/app/controllers/makers_controller.rb
autocompl-0.1.0 test/dummy/app/controllers/makers_controller.rb
autocompl-0.0.1 test/dummy/app/controllers/makers_controller.rb