ActiveSupport::MessageVerifier::InvalidSignature error when updating a model with the same image

295 views
Skip to first unread message

belgoros

unread,
Nov 5, 2018, 11:54:06 AM11/5/18
to Ruby on Rails: Talk
I can't figure out the reason of the error I get when updating a model containing an attached image without changing the image:

    Processing by PostsController#update as JSONAPI
     
Parameters: {"data"=>{"id"=>"28", "attributes"=>{"title"=>"post-1", "body"=>"azertyui", "archived"=>true, "tag_ids"=>[11, 12, 13], "photo"=>"http://localhost:3000/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--86e7464f36c2eddf776573af7b9e61d969287158/diagram.png"}, "type"=>"posts"}, "id"=>"28"}


The error I'm getting is as follows:

    Completed 500 Internal Server Error in 5ms (ActiveRecord: 0.5ms)
   
ActiveSupport::MessageVerifier::InvalidSignature (ActiveSupport::MessageVerifier::InvalidSignature):
    app
/controllers/posts_controller.rb:30:in `update'


Here is the controller update action code:

    def update
       
if @post.update(post_params)
         
@post.photo.attach(post_params[:photo])
          render json
: @post
       
else
          respond_with_errors
@post
       
end
     
end



I'm using Rails 5.2.0 API. What am I missing ?

Reply all
Reply to author
Forward
0 new messages