Sha256: 53ad1684d2b0b2e07569add5a4189dddc3521d7783bf0b715be653837becb4ab

Contents?: true

Size: 595 Bytes

Versions: 4

Compression:

Stored size: 595 Bytes

Contents

require_dependency "brightcontent/application_controller"

module Brightcontent
  class AttachmentsController < ApplicationController

    def show
      @attachments = Attachment.where(attachable_type: params[:type].classify, attachable_id: params[:id])
      render layout: false
    end

    def create
      @attachment = Attachment.new(params.slice(:attachable_id, :attachable_type, :asset))
      if @attachment.save
        render json: @attachments.to_json, status: :created
      else
        render json: @attachments.errors, status: :unprocessable_entity
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
brightcontent-attachments-2.0.9 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.8 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.7 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.6 app/controllers/brightcontent/attachments_controller.rb