Sha256: adc51fe07285b5e2e66d6e3de691b6b75a9d0752fe4da75b019180f9f2977f1b

Contents?: true

Size: 709 Bytes

Versions: 20

Compression:

Stored size: 709 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: @attachment.to_json, status: :created
      else
        render json: @attachment.errors, status: :unprocessable_entity
      end
    end

    def destroy
      attachment = Attachment.destroy(params[:id])
      redirect_to attachment.attachable
    end

  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
brightcontent-attachments-2.0.29 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.28 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.27 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.26 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.25 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.24 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.23 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.22 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.21 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.20 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.19 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.18 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.17 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.16 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.15 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.14 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.13 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.12 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.11 app/controllers/brightcontent/attachments_controller.rb
brightcontent-attachments-2.0.10 app/controllers/brightcontent/attachments_controller.rb