Hi,
I´m using the Lightning-Fast Javascript Autocompletion recipe from
Rails Recipes.
When I add or remove users in the contact list, changes are
immediately reflected in the conacts_for_lookup js array. Indicating
that both the javascript and method is executed when reloading
_send.rhtml
But after a while, the js array is empty:
var contacts = new Array(0);
Is there a caching issue, causing the method not to be executed every
time?
If I logout and in again, the array is back.
I´m running in development environment.
views/sms/_send.rhtml
contacts_controller.rb:
def contacts_for_lookup
@contacts = Contact.find(:all,
:conditions => “company =
‘#{session[:user_number]}’”)
headers[‘content-type’] = ‘text/javascript’
render :layout => false
end
contacts_for_lookup.js
var contacts = new Array(<%= @contacts.size %>);
<% @contacts.each_with_index do |contact, index| %>
contacts[<%= index %>] = “<%= contact.name %>”;
<% end %>
Any tips or hints are highly appreciated! 
Regards,
Martin S.