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
<script src="/contacts/contacts_for_lookup" type="text/
javascript"></script>
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 Stabenfeldt
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---