InheritedResources swallowing exceptions
I use InheritedResources a fair bit in apps that I build simply because it makes it quick to get up and running. Â It allows for faster setup because you don't have to write anything for the typical CRUD. Â I particularly find it useful with JSON, until yesterday.
I rely on the server to build the HTML and return both the object and html in the json (when needed). Â In doing this I added the line
success.json { render :json => {:object => resource, :html => render_to_string(:partial => 'resources/resource_row')} }
The exception occurs in trying to render the partial. Â There is not resource_row.json, just html. Â The problem I found was that it was swallowing the exception and returning the default response which in json case, was just the resource standard to_json
So, hopefully I can patch it so that it won't swallow the exception and leave others chasing the issue. Â In the meantime, if you have something standard coming back even though you have overode the default, check if it is throwing an exception.
(InheritedResources can be found here:Â https://github.com/josevalim/inherited_resources/ and I will be writing a patch for this issue shortly)













