We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am trying to make an API only Rails app (Rails 5.0.1). In my Service model I have something like:
class Service < ApplicationRecord mount_uploaders :photos, ServicePhotoUploader end
I noticed this issue while I was making the test script for my ServicesController. However, I managed to replicate it in the test environment console.
> service = Service.new() > service.photos = [ Rack::Test::UploadedFile.new(File.join(Rails.root, 'spec', 'fixtures', 'images', 'altia.jpg')) ] > service.save! > service.to_json => "{\"id\":3053,\"photos\":[{\"url\":\"/uploads/service/photos/3053/altia.jpg\"}]}"
The result looks ok. But when I do service.reload the result looks weird.
service.reload
> service.reload > service.to_json => "{\"id\":3053, \"photos\":[{\"url\":\"/uploads/service/photos/3053/%5B%22altia.jpg%22%5D\"}]}"
Decoded, the 'url' value loooks like:
> URI.decode "/uploads/service/photos/3053/%5B%22altia.jpg%22%5D" => "/uploads/service/photos/3053/[\"altia.jpg\"]"
This is causing an issue when I to JSON.parse( respond.body ) in my test script.
JSON.parse( respond.body )
Is this the expected result? or am I doing something wrong?
Thanks!
The text was updated successfully, but these errors were encountered:
Not reproducible here, how does your uploader and test code look like?
Sorry, something went wrong.
Hi,
I can't replicate this in the latest version anymore.
No branches or pull requests
I am trying to make an API only Rails app (Rails 5.0.1). In my Service model I have something like:
I noticed this issue while I was making the test script for my ServicesController. However, I managed to replicate it in the test environment console.
The result looks ok. But when I do
service.reload
the result looks weird.Decoded, the 'url' value loooks like:
This is causing an issue when I to
JSON.parse( respond.body )
in my test script.Is this the expected result? or am I doing something wrong?
Thanks!
The text was updated successfully, but these errors were encountered: