Module: RemovableImage
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/concerns/removable_image.rb
Overview
Adds action for removing entity image in column “image”
Instance Method Summary collapse
-
#destroy_image ⇒ Object
Remove entity image when allowed.
Instance Method Details
#destroy_image ⇒ Object
Remove entity image when allowed
8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/concerns/removable_image.rb', line 8 def destroy_image if entity_image_is_locked? render json: { errors: { locked: true } }, status: :forbidden elsif entity_image_is_editable? @entity.remove_image! render json: { meta: { result: @entity.save } } else head :unauthorized end end |