jejacks0n/mercury — Issue #32: Image JSON returned by Rails does not match server spec?
Author: geirgluckstad
Created: 2011-10-12 16:23:44+00:00
State: open

Firstly, thanks for a truly interesting project :-)

With the GIT revision cf6622433ccc303871d2cfdf1df1dd1e276cd198 I found that Image objects converted to JSON does not match the server specification on the Wiki. The specification says:

{"image":{"url":"/system/images/1/original/imagename.jpg?1309022763"}}

Which also seems to be expected by JavaScript client code.

But I found the nested image object to be missing after succefully uploading an image resulting in an JavaScript popup.

I tested by adding a to_json to the Image class:

```ruby
def as_json(options = {})
{
:image => { :url => self.url }
}
end
```

And that works.

Rails version: 3.1.1.rc1