Class: Motor::ActiveStorageAttachmentsController

Inherits:
ApiBaseController
  • Object
show all
Includes:
WrapIoParams
Defined in:
app/controllers/motor/active_storage_attachments_controller.rb

Instance Method Summary collapse

Methods included from CurrentAbility

#current_ability

Methods included from CurrentUserMethod

#current_user

Instance Method Details

#createObject


11
12
13
14
15
16
17
18
19
# File 'app/controllers/motor/active_storage_attachments_controller.rb', line 11

def create
  if attachable?(record)
    record.public_send(@attachment.name).attach(file_params)

    head :ok
  else
    head :unprocessable_entity
  end
end