'tabExhibitions', :id => @app.id,...">

Rails 3: remote => true does not call AJAX requests

I have the following:

<%= link_to "Exhibitions", :action => 'tabExhibitions', :id => @app.id, :remote => true %> 

It generates:

 <div class="tabbarButton" id="tabbarExhibitions"> <a href="/apps/3/tabExhibitions?remote=true">Exhibitions</a> </div> 

This results in a general GET request on click.

I am new to Rails, but I realized that the parameter :remote => true should have created <a href="..." data-remote=true> instead of a simple link.

I use jQuery, the necessary headers and meta tags in place. I should mention that this project has been updated with Rails 2.3.8.

Thanks for the help.

+7
source share
1 answer

link_to puts :remote => true in the url part of the argument list and creates a query string parameter for it (see the parameters in the documentation ). Essentially, you wrote:

 <%= link_to "Exhibitions", { :action => 'tabExhibitions', :id => @app.id, :remote => true } %> 

You will need a separate hash for html_options :

 <%= link_to "Exhibitions", { :action => 'tabExhibitions', :id => @app.id }, :remote => true %> 
+10
source

All Articles