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)
render json: @post
else
respond_with_errors @post
end
end
Here is what PostSerializer
looks like:
class PostSerializer < ActiveModel::Serializer
include Rails.application.routes.url_helpers
attributes :id, :title, :body, :tag_ids, :archived, :photo
def photo
rails_blob_url(object.photo) if object.photo.attached?
end
end
I'm using Rails 5.2.0 API. What am I missing ?