links which substantiate my guess ;-)
http://ryandaigle.com/articles/2007/9/24/what-s-new-in-edge-rails-better-cross-site-request-forging-prevention
http://henrik.nyh.se/2008/05/rails-authenticity-token-with-jquery

On Jul 24, 7:45 am, clemens <[email protected]> wrote:
> my guess:
> auto_complete_for_team_name is called through ajax and the ajax call
> does not provide (bring along) any authenticity_token...
>
> On Jul 24, 6:59 am, "Älphä Blüë" <[email protected]>
> wrote:
>
>
>
> > I believe I found a partial answer:
>
> > In my teams controller I placed:
>
> > class TeamsController < ApplicationController
> >   skip_before_filter :verify_authenticity_token, :only =>
> > [:auto_complete_for_team_name]
>
> > def auto_complete_for_team_name()
> >   team_name = params[:team][:name]
> >   @teams = Team.find(:all, :conditions => ['name LIKE ?', "%" +
> > team_name + "%"])
> >   render :partial => 'teamname'
> > end
>
> > def virtual_matchups
> > end
>
> > In my virtual_matchups.html.erb file I placed as a test:
>
> > <h1> Test Virtual Matchups </h1>
> > <%= text_field_with_auto_complete :team, :name ,{}, :skip_style => false
> > %>
>
> > I created a partial for teamname:
>
> > <ul>
> >   <% for team in @teams do %>
> >     <li>
> >       <div>
> >         <%=h team.name %>
> >       </div>
> >     </li>
> >   <% end %>
> > </ul>
>
> > In my routing file I placed:
>
> > map.virtual_matchups '/virtual_matchups', :controller => 'teams',
> > :action => 'virtual_matchups'
>
> > I restarted the server and the autocomplete works for this page, but I
> > haven't tried it with a form.
>
> > My thoughts on this are it was very cumbersome to get it to work.  I had
> > to go through several different sites, put together all the pieces of
> > the puzzle before it finally worked.
>
> > I have no idea why I had to use the skip_before_filter but without it,
> > it would not autocomplete.
>
> > Can someone please look over the fixes I provided and if you have
> > knowledge of autocomplete let me know if there is a simpler way of
> > getting it to work, and/or what I need to do to polish up the code I
> > created thus far to get it to work?
>
> > I will need two fields and a submit button that performs a query to the
> > same controller but to a different action that will render a completely
> > different partial containing information.
>
> > Many thanks in advance.
>
> > --
> > Posted viahttp://www.ruby-forum.com/.- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to