Class: LadyJosephine::ImagesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- LadyJosephine::ImagesController
- Defined in:
- app/controllers/lady_josephine/images_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/lady_josephine/images_controller.rb', line 4 def create image = Image.from_params image_params if image.save response = {file: {url: image.file.url}} render json: response.as_json, status: 200 else render json: image.file.errors, status: 500 end end |
#image_params ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'app/controllers/lady_josephine/images_controller.rb', line 16 def image_params params.require(:attachment).permit([:name, :file]) params.require("block-uuid") params.require("article-uuid") params.require("model-name") params.require("column-name") params end |