I have a link labeled :remote => true , which makes a request to receive Controller#show as JS and displays in the browser. Upon completion of this request, another receive request is processed for Controller#show as HTML .
During debugging, I wrapped the contents of the show action in if request.xhr? && !request.format.html? if request.xhr? && !request.format.html?
The first Controller#show as JS request was correctly displayed in the browser, and the inadvertent rendering of Controller#show as HTML failed, and nothing made it explicit in the browser.
My question is: did anyone experience this subsequent html call after js call? I cannot find anything in my code causing this.
Link Code
= link_to article.name, blog_path(article.name.downcase.gsub(' ','-')), :remote => true
Controller code
def show article_name = params[:id].gsub('-',' ') @article = Article.find_by_name(article_name) respond_to do |format| format.html
show.js.haml code
$('#content_index.blog').html("#{escape_javascript(render('article'))}");
_article.html.haml code
.blog_post %h2 = @article.name %img{:src => "#"}/ .blog_text %p = @article.content %center .blog_post_bottom
routes.rb code
resources :articles, :only => [:index, :show] resources :blog, :controller => :articles
Log output from one js request (also happens for html request with javascript disabled in the browser)
Started GET "/blog" for 127.0.0.1 at Thu Nov 03 14:38:29 -0400 2011 Processing by ArticlesController