Sha256: a2bde9a1a16a236e28286bb96ee345dda86492c3c69abe70d6a353eb065f8042

Contents?: true

Size: 679 Bytes

Versions: 19

Compression:

Stored size: 679 Bytes

Contents

module Spotlight
  ##
  # Create image attachments for the sir-trevor image widget
  class AttachmentsController < ApplicationController
    before_action :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

19 entries across 19 versions & 1 rubygems

Version Path
blacklight-spotlight-0.13.0 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.12.1 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.12.0 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.11.0 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.10.3 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.10.2 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.10.1 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.10.0 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.9.2 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.9.1 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.9.0 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.8.2 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.8.1 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.8.0 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.7.2 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.7.1 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.7.0 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.6.0 app/controllers/spotlight/attachments_controller.rb
blacklight-spotlight-0.5.0 app/controllers/spotlight/attachments_controller.rb