Sha256: 7cb78646d0386592ed3e216cb54c641a770e9ce62f2bd900702c8e1fb05cb55b

Contents?: true

Size: 624 Bytes

Versions: 4

Compression:

Stored size: 624 Bytes

Contents

module Spotlight
  class AttachmentsController < ApplicationController
    before_filter :authenticate_user!
    load_and_authorize_resource :exhibit, class: "Spotlight::Exhibit"
    load_and_authorize_resource through: :exhibit

    # POST /attachments
    def create
      @attachment.attributes = attachment_params
      if @attachment.save
        render :json => @attachment
      else
        render action: 'new'
      end
    end

    private

      # Only allow a trusted parameter "white list" through.
      def attachment_params
        params.require(:attachment).permit(:name, :file, :uid)
      end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blacklight-spotlight-0.4.1 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.3.1 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.3.0 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.2.0 app/controllers/spotlight/attachments_controller.rb