Forum: Ruby on Rails json.erb views and strange caching

7544bc8aa7bacb5512774a33684da163?d=identicon&s=25 DEfusion (Guest)
on 2008-07-07 15:34
(Received via mailing list)
I'm responding in JSON in quite a lot of places within my application
and as I'm doing quite a bit of work (e.g. defining which
relationships to return and which fields etc.) within my to_json()
calls I decided to move from:

render :json => @obj.to_json( .... )

Within my controller and to move them to views, so for example I
created a show.json.erb which has:

<%= @obj.to_json(...) -%>

This seems to work, however when I change the view (e.g. add or remove
attributes it will include in the json - within the :only param) when
the app is running (in development mode) the changes are not applied
within the response, I have to kick the server to make it update.

Firstly am I correct in my use/formatting of the json.erb view and if
so does anyone know of a workaround to this issue (I've tried both on
Rails 2.0 & 2.1 and get the same issue on both).
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.