How to handle 'ActiveRecord::RecordInvalid Exception' while we upload image with 'carrierwave' gem through child of a class (STI) in ruby on rails?

I'm using 'carrierwave' gem to upload image.
theses are my models:


class Content < ApplicationRecord
    validates_presence_of :file


class Image < Content
    mount_uploader :file, ::ImageUploader

I use postman to post image. and it's params field is file While I try to create new Image, it returns nil id.

rails console:

file = params[:file]
::Image.create(file: file)


 id: nil
 file: nil,

then, it gives the following error:

*** ActiveRecord::RecordInvalid Exception: Validation failed: File 
can't be blank, File Failed to manipulate with MiniMagick, maybe it is 
not an image? Original Error: You must have ImageMagick or 
GraphicsMagick installed

P.S: I have a lot of other fields, but I show only one file filed for understanding easily.

1 answer