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).