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