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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
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).
This topic is locked and can not be replied to.