2010-04-16 4 views
1

J'ai eu le même problème à ce poste ici: https://rails.lighthouseapp.com/projects/8994/tickets/106-authenticity_token-appears-in-urls-after-ajax-get-requestremote_function continue d'ajouter jeton d'authenticité demande GET

routes.rb

map.namespace(:admin, :active_scaffold => true) do |admin| 
    admin.resources :regions, :shallow => true do |region| 
     region.resources :birds, :collection => {:search => :get} 
    end 
    end 

vue

<%= javascript_tag %Q(
    #{remote_function(:update => 'bird_search', :url => search_admin_region_birds_path(@region.id), :method => :get)} 
) %> 

Il affiche l'url: http://localhost:3000/admin/regions/7/birds/search?authenticity_token=F43BcQUM4z3bl7s21kLZQrqwGkuErF7C9jiNMKFTZTo%3D

qui devrait être : http://localhost:3000/admin/regions/7/birds/search

Sans cela, ma pagination Ajax ne fonctionnera pas ... aide!

Répondre

0

fixe ce en utilisant Javascript au lieu d'utiliser RJS.

Souvent, les méthodes RJS ne sont pas très fiables lorsque vos applications se compliquent, alors faites attention.

En tout cas pour ce problème, je changé le code:

<%= javascript_tag %Q(
    new Ajax.Updater('region_birds', '#{of_region_admin_region_birds_path(@region.id)}', {asynchronous:true, evalScripts:true, method:'get'}); 
) %> 
Questions connexes