Sha256: 4af7d7516f169b86c8f5309dd68a9ab91ba62b179540c7582f588d26b5051d53

Contents?: true

Size: 1.26 KB

Versions: 8

Compression:

Stored size: 1.26 KB

Contents

class PublishersController < ApplicationController
  before_action :set_publisher, only: [:show, :edit, :update, :destroy]

  # GET /publishers
  def index
    @publishers = Publisher.all
  end

  # GET /publishers/1
  def show
  end

  # GET /publishers/new
  def new
    @publisher = Publisher.new
  end

  # GET /publishers/1/edit
  def edit
  end

  # POST /publishers
  def create
    @publisher = Publisher.new(publisher_params)

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

  # PATCH/PUT /publishers/1
  def update
    if @publisher.update(publisher_params)
      redirect_to @publisher, notice: 'Publisher was successfully updated.'
    else
      render :edit
    end
  end

  # DELETE /publishers/1
  def destroy
    @publisher.destroy
    redirect_to publishers_url, notice: 'Publisher was successfully destroyed.'
  end

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

    # Only allow a trusted parameter "white list" through.
    def publisher_params
      params.require(:publisher).permit(:name, :url, :description, :email, :category_id, :epom_id)
    end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
epom_rails-1.4.4 test/dummy/app/controllers/publishers_controller.rb
epom_rails-1.4.2 test/dummy/app/controllers/publishers_controller.rb
epom_rails-1.4.1 test/dummy/app/controllers/publishers_controller.rb
epom_rails-1.4.0 test/dummy/app/controllers/publishers_controller.rb
epom_rails-1.3.6 test/dummy/app/controllers/publishers_controller.rb
epom_rails-1.3.5 test/dummy/app/controllers/publishers_controller.rb
epom_rails-1.3.2 test/dummy/app/controllers/publishers_controller.rb
epom_rails-1.0.0 test/dummy/app/controllers/publishers_controller.rb