Sha256: 329f1b98e1524bc846135475ec1770084efa6e4f93399033838a9898d949a83d

Contents?: true

Size: 1.36 KB

Versions: 17

Compression:

Stored size: 1.36 KB

Contents

require_dependency "binda/application_controller"

module Binda
  class GalleriesController < ApplicationController
    before_action :set_gallery, only: [:show, :edit, :update, :destroy]

    # GET /galleries
    def index
      @galleries = Gallery.all
    end

    # GET /galleries/1
    def show
    end

    # GET /galleries/new
    def new
      @gallery = Gallery.new
    end

    # GET /galleries/1/edit
    def edit
    end

    # POST /galleries
    def create
      @gallery = Gallery.new(gallery_params)

      if @gallery.save
        redirect_to gallery_path( @gallery.id ), notice: 'Gallery was successfully created.'
      else
        render :new
      end
    end

    # PATCH/PUT /galleries/1
    def update
      if @gallery.update(gallery_params)
        redirect_to gallery_path( @gallery.id ), notice: 'Gallery was successfully updated.'
      else
        render :edit
      end
    end

    # DELETE /galleries/1
    def destroy
      @gallery.destroy
      redirect_to galleries_url, notice: 'Gallery was successfully destroyed.'
    end

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

      # Only allow a trusted parameter "white list" through.
      def gallery_params
        params.require(:gallery).permit( :position )
      end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
binda-0.1.11 app/controllers/binda/galleries_controller.rb
binda-0.1.10 app/controllers/binda/galleries_controller.rb
binda-0.1.9 app/controllers/binda/galleries_controller.rb
binda-0.1.8 app/controllers/binda/galleries_controller.rb
binda-0.1.7 app/controllers/binda/galleries_controller.rb
binda-0.1.6 app/controllers/binda/galleries_controller.rb
binda-0.1.5 app/controllers/binda/galleries_controller.rb
binda-0.1.4 app/controllers/binda/galleries_controller.rb
binda-0.1.3 app/controllers/binda/galleries_controller.rb
binda-0.1.2 app/controllers/binda/galleries_controller.rb
binda-0.1.1 app/controllers/binda/galleries_controller.rb
binda-0.1.0 app/controllers/binda/galleries_controller.rb
binda-0.0.7 app/controllers/binda/galleries_controller.rb
binda-0.0.6 app/controllers/binda/galleries_controller.rb
binda-0.0.5 app/controllers/binda/galleries_controller.rb
binda-0.0.3 app/controllers/binda/galleries_controller.rb
binda-0.0.2 app/controllers/binda/galleries_controller.rb