'there is any answer for image upload error in rails?

when i upload the i got this error in rails application

ActiveSupport::MessageVerifier::InvalidSignature (ActiveSupport::MessageVerifier::InvalidSignature):

i used form for upload image like this one

<%= form.label :image, "Profile Photo" %>
  <%= form.file_field :image %>

this is my model:

class User < ApplicationRecord

  has_one_attached :image
  
end

this is my controller params:

def user_params
    params.permit(:name, :phone, :address, :gender, :adhar_number, :image)
  end


Solution 1:[1]

Your form should look like this:

<%= form.label :image, "Profile Photo" %>
  <%= form.file_field :image, accept: "image/*", direct_upload: true %>

It works fine for me. Try this one if you have an error like this.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeremy Caney