If I comment out the render :inline => '<%=
model_auto_completer_result(@recipients, :name) %>' I get the normal
layout back. Is it a problem with loading the
auto_complete_belongs_to_for as a before_filter?
Just remove the before_filter macro call, and make
auto_complete_belongs_to_for_invitation_recipient_name public.
That method is called automatically by the helper through Ajax when
the user enters something into the field. You typically won't call it
explicitly.
We're nearly there - it'll be worth it, I'm sure! I'm just getting this;
ActionController::InvalidAuthenticityToken in
GroupsController#auto_complete_belongs_to_for_invitation_recipient_name
ActionController::InvalidAuthenticityToken
Hi Neil, that's related to Ajax calls and the request from forgery
protection. Just google for
"ActionController::InvalidAuthenticityToken ajax".
I couldn't work out why I was getting the
ActionController::InvalidAuthenticityToken on this particular form_for,
even after doing some reading round. I tried two approaches, and neither
resolved the issue;
[1] <% form_for ([@group, @invitation]), :id => "invitation_form" do |f|
%>
[2] <% form_for :invitation, :url => group_invitations_path(@group) do
f> %>
So, to skip the trial & error on the token problem, I commented out the
protect_from_forgery, just so I could get the auto_complete actually
working first, and I don't seem to get any results back at all. I'm
still using the same set up as before and I did have the auto_complete
plugin working, so I know it's not a problem with js. When I un-comment
the display="none" on the hidden div, it seems as though it contains a
whole new DOM within the hidden div; the whole of another
application.html.erb seems to be hidden in there!