Class: Brightcontent::AttachmentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Brightcontent::AttachmentsController
- Defined in:
- app/controllers/brightcontent/attachments_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/controllers/brightcontent/attachments_controller.rb', line 10 def create @attachment = Attachment.new() if @attachment.save render json: @attachment.to_json, status: :created else render json: @attachment.errors, status: :unprocessable_entity end end |
#destroy ⇒ Object
19 20 21 22 |
# File 'app/controllers/brightcontent/attachments_controller.rb', line 19 def destroy Attachment.destroy params[:id] head :no_content end |
#reposition ⇒ Object
24 25 26 27 |
# File 'app/controllers/brightcontent/attachments_controller.rb', line 24 def reposition Attachment.for_attachable(params[:type], params[:id]).reposition! params[:positions] head :no_content end |
#show ⇒ Object
5 6 7 8 |
# File 'app/controllers/brightcontent/attachments_controller.rb', line 5 def show @attachments = Attachment.for_attachable(params[:type], params[:id]) render layout: false end |