rjs templates in Rails 2.2.2 sometimes set the mime type of the
response to text/html instead of text/javascript. Therefore no js
interpreted in the browser. Rails 2.2.0 works correctly; 2.2.2 does
not appear to.
Failure Example: http://www.noexpectations.com.au
Scroll to the bottom of the page to cause a js request to the
server which returns javascript from an rjs template. Header mime
type is incorrectly set as text/html.
It does not happen in all cases. For example, http://www.noexpectations.com.au...
has the same "endless page" functionality and in this case the rjs
response has the correct mime type of text/javascript
Failing rjs template in 2.2.2 (works in 2.2.0): page.insert_html
:bottom, :articles, :partial => "articles" if
@articles.page_count > @articles.page page[:loading].hide
page.call 'checkScroll' else page[:loading].hide end
Note partial :articles calls other .html.erb templates possibly
causing response mime type to be overwritten (?):
<% for article in @articles -%>
<div id="<%= 'article_' + article.id.to_s -%>" class="_article" >
<h2><%= link_to h(article.title), article %></h2>
<%= render :partial => "article_byline", :locals => {:article => article} -%>
<%= render_excerpt(article) -%>
<%= render(:partial => "article_footer", :locals => {:article => article}) -%>
</div>
<% end %>