Class: Admin::AttachmentsController

Inherits:
AdminController show all
Defined in:
app/controllers/admin/attachments_controller.rb

Instance Attribute Summary

Attributes included from PagesCore::Authentication

#current_user

Instance Method Summary collapse

Methods inherited from PagesCore::AdminController

#redirect, underscore

Methods included from PagesCore::StaticCacheController

#disable_static_cache!

Methods included from PagesCore::PoliciesHelper

#policy, #verify_policy, #verify_policy_with_proc

Methods included from PagesCore::ProcessTitler

inc_number_of_requests, original_title

Methods included from PagesCore::ErrorRenderer

#render_error

Methods included from PagesCore::Authentication

#authenticate!, #deauthenticate!, #logged_in?

Instance Method Details

#createObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/admin/attachments_controller.rb', line 7

def create
  @attachment = Attachment.create(
    attachment_params.merge(user: current_user)
  )
  return unless @attachment.valid?

  respond_to do |format|
    format.json do
      render_attachment(@attachment)
    end
  end
end

#updateObject



20
21
22
23
24
25
# File 'app/controllers/admin/attachments_controller.rb', line 20

def update
  @attachment.update(attachment_params)
  respond_to do |format|
    format.json { render_attachment(@attachment) }
  end
end