Sha256: d9e01d3faa7ca9769f4c03c6a961d0475d549503b06e368831c81ac1f939a40b

Contents?: true

Size: 952 Bytes

Versions: 14

Compression:

Stored size: 952 Bytes

Contents

# Handles file uploads for content pictures.
require_dependency "lines/admin/application_controller"

module Lines


  class Admin::PicturesController < Admin::ApplicationController
    def create
      @picture = Picture.create(picture_params)
    end

    # PUT /admin/pictures/1
    def update
      @picture = Picture.find(params[:id])

      respond_to do |format|
        if @picture.update_attributes(picture_params[:picture])
          format.html { redirect_to @picture, notice: 'Picture was successfully updated.' }
        else
          format.html { render action: "edit" }
        end
      end
    end

    # Deletes a picture. Only responds to JS requests.
    def destroy
      @picture = Picture.find(params[:id])
      @picture.destroy

      respond_to do |format|
        format.js
      end
    end

    private

      # strong_params
      def picture_params
        params.fetch(:picture, {}).permit(:image)
      end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
lines-engine-0.1.17 app/controllers/lines/admin/pictures_controller.rb
lines-engine-0.1.16 app/controllers/lines/admin/pictures_controller.rb
lines-engine-0.1.14 app/controllers/lines/admin/pictures_controller.rb
lines-engine-0.1.13 app/controllers/lines/admin/pictures_controller.rb
lines-engine-0.1.12 app/controllers/lines/admin/pictures_controller.rb
lines-engine-0.1.11 app/controllers/lines/admin/pictures_controller.rb
lines-engine-0.1.10 app/controllers/lines/admin/pictures_controller.rb
lines-engine-0.1.9 app/controllers/lines/admin/pictures_controller.rb
lines-engine-0.1.8 app/controllers/lines/admin/pictures_controller.rb
lines-engine-0.1.7 app/controllers/lines/admin/pictures_controller.rb
lines-engine-0.1.6 app/controllers/lines/admin/pictures_controller.rb
lines-engine-0.1.5 app/controllers/lines/admin/pictures_controller.rb
lines-engine-0.1.4 app/controllers/lines/admin/pictures_controller.rb
lines-engine-0.1.3 app/controllers/lines/admin/pictures_controller.rb