Hi,
I’m experiencing a strange problem on an application this is in the
process of being converted from Rails 2.3 to 3.0.3. I have several
controllers that are rendering either HTML or JSON depending on the
requested format, using respond_to:
respond_to |wants|
wants.html
wants.json {render :json => “blah”}
end
One controller works just fine. The other is sending the wrong
content type header - “text/html” instead of “application/json”. If I
remove the respond_to block in the second controller, and just
render :json all the time, then the correct type is sent. There are
no apparent differences between the working and non-working
controllers except the model being retrieved from the database. I’ve
tried reducing the actions down to rendering just a string as JSON (as
seen above) and still have the same problem.
Does anyone have a suggest as to what could be happening? How can I
trace the response back through the Rails stack to perhaps see where
the content type is being set (or not set?)
I can provide more detail if needed.
Thanks!
Pete