Ruby on Rails Monday, November 5, 2018

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 ?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/599e5891-b5dc-4e9a-80c7-6a176e38e35d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment