Not intentional. I didn't really think of this case, the test I removed showed a stupid use case of rendering it with an inline.
I'm interesting in fixing this, but I'd rather not restore the hack in ActionView. This logic should be in ActionController. Please do ticket me and we'll eventually sort this out. I can't think of a good clean way to extend the format picking logic right now. I kind of feel like the XHR request should be saying "Give me HTML plz!". Dunno if thats possible or a good idea. On Dec 20, 9:53 am, "Mislav Marohnić" <[email protected]> wrote: > Josh Peek recently > commitedhttp://github.com/rails/rails/commit/148aff2097890a81e874a7c60bae5fa3..."Set > template_format to html inside rjs templates so renders within it default to > html." > > This broke controller actions like this: > > def show > render :partial => 'item' if request.xhr? > end > > This action would render default template on ordinary requests and a > "_item.html.erb" partial on XHR requests. > > After this commit, if there's an XHR request this raises an exception that > "_item.erb" can't be found. It probably discards the "html" format template > because the request is in "js" format. Workarounds are these: > > def show > respond_to do |format| > format.html { render :partial => 'item' if request.xhr? } > end > end > > or: > > def show > @template.template_format = 'html' > render :partial => 'item' if request.xhr? > end > > Both of these make sense because they kinda explicitly state that they don't > care if the request was "js" format, they will respond in "html" anyway. > > So my question is, was this breakage deliberate? Was the way I rendered HTML > partials before wrong? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
