Sha256: cb900d639923af49cffd86d1d887f208a750582458f415d2c6e5988f1c10b3d1

Contents?: true

Size: 1.37 KB

Versions: 5

Compression:

Stored size: 1.37 KB

Contents

require_dependency "binda/application_controller"

module Binda
  class BindingsController < ApplicationController
    before_action :set_binding, only: [:show, :edit, :update, :destroy]

    # GET /bindings
    def index
      @bindings = Binding.all
    end

    # GET /bindings/1
    def show
    end

    # GET /bindings/new
    def new
      @binding = Binding.new
    end

    # GET /bindings/1/edit
    def edit
    end

    # POST /bindings
    def create
      @binding = Binding.new(binding_params)

      if @binding.save
        redirect_to binding_path( @binding.id ), notice: 'Binding was successfully created.'
      else
        render :new
      end
    end

    # PATCH/PUT /bindings/1
    def update
      if @binding.update(binding_params)
        redirect_to binding_path( @binding.id ), notice: 'Binding was successfully updated.'
      else
        render :edit
      end
    end

    # DELETE /bindings/1
    def destroy
      @binding.destroy
      redirect_to bindings_url, notice: 'Binding was successfully destroyed.'
    end

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

      # Only allow a trusted parameter "white list" through.
      def binding_params
        params.require(:binding).permit(:title, :description, :position)
      end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
binda-0.0.7 app/controllers/binda/bindings_controller.rb
binda-0.0.6 app/controllers/binda/bindings_controller.rb
binda-0.0.5 app/controllers/binda/bindings_controller.rb
binda-0.0.3 app/controllers/binda/bindings_controller.rb
binda-0.0.2 app/controllers/binda/bindings_controller.rb