Sha256: 51889002430916f8fa19f44ca60cbaea2004eea9f9c08125f3e5970f9cf6845e

Contents?: true

Size: 574 Bytes

Versions: 3

Compression:

Stored size: 574 Bytes

Contents

module Admin
  class ImagesController < Admin::ApplicationController
    def index
      @images = post.images
      respond_to do |format|
        format.js
      end
    end

    def update
      @image = post.header
      if @image.update(image_params)
        @image.touch
      else
        render 'errors'
      end
    end

    def destroy
      @image = post.header
      @image.clear!
    end

    protected

    def post
      @post ||= Admin::Post.find(params[:post_id])
    end

    def image_params
      params.require(:image).permit(:file)
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ecrire-0.22.1 lib/ecrire/app/controllers/admin/images_controller.rb
ecrire-0.21.0 lib/ecrire/app/controllers/admin/images_controller.rb
ecrire-0.20.0 lib/ecrire/app/controllers/admin/images_controller.rb