Class: ActiveStorageDB::FilesController
- Inherits:
-
ActiveStorage::BaseController
- Object
- ActiveStorage::BaseController
- ActiveStorageDB::FilesController
- Defined in:
- app/controllers/active_storage_db/files_controller.rb
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/active_storage_db/files_controller.rb', line 7 def show if (key = decode_verified_key) serve_file(key[:key], content_type: key[:content_type], disposition: key[:disposition]) else head(:not_found) end rescue ActiveStorage::FileNotFoundError head(:not_found) end |
#update ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/active_storage_db/files_controller.rb', line 17 def update if (token = decode_verified_token) file_uploaded = upload_file(token, body: request.body) head(file_uploaded ? :no_content : :unprocessable_entity) else head(:not_found) end rescue ActiveStorage::IntegrityError head(:unprocessable_entity) end |