Micah Alcorn
unread,Feb 7, 2012, 4:14:06 PM2/7/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to carrierwave
I have two applications where JSON is rendered by a Rails API for use
on a mobile client. Both apps use CarrierWave 0.5.8 with Rails 3.1+
and Fog to connect to Rackspace Cloud Files. One uses mongoid and the
other activerecord.
In both cases, if my controller retrieves an array and renders HTML,
there is no problem. But if I render JSON and the model includes a CW
attachment, the rendering is exponentially slower. For example, my
User has many Photos, each containing an Image (CW). If
@current_user.photos.count == 13, then the Rails default JSON render
will take about ninety (90) seconds! Rendering HTML might take three
(3) seconds.
However, if I use json_builder and do not include Image object, then
JSON rendering takes approximately the same amount of time as HTML.
Then I have to reconstruct the Image urls manually on the client side,
which is don't think is a good long term solution.
Is this normal, or am I missing something? Thanks!