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 27 28 29 |
# File 'app/controllers/active_storage_db/files_controller.rb', line 17 def update if (token = decode_verified_token) if acceptable_content?(token) db_service.upload(token[:key], request.body, checksum: token[:checksum]) else head :unprocessable_entity end else head :not_found end rescue ActiveStorage::IntegrityError head :unprocessable_entity end |