Sean Hussey
2006-Apr-18 19:50 UTC
[Rails] AJAX not displaying - due to action not complete?
Hi everyone, I''ve got a pair of AJAX actions that use slide_up and slide_down to toggle the editing of some info. You first see a table of entitlements for a user. Clicking "Change these" slides that up and then a full table comes down, displaying all possible entitlements for that user. Remove and Add links are next to the appropriate entitlements. When finished, clicking "I''m finished" slides the big table back up and the new smaller table back down. In dev, this works great. Of course, doing dev on the same machine as the database. In live, it works sporadically. The movement is choppy, flashy (like, here one split-second and gone the next), and sometimes the table doesn''t return. The whole thing depends upon calls to a db (pgsql on a remote host) and to LDAP. I''m wondering if the LDAP calls don''t happen quickly enough, so the whole process dies. The production machine is closer in terms of network than my dev machine, so I don''t know if that''s the issue. Do my link_to_remote calls look ok? <%= link_to_remote("Change Entitlements", :update => "entitlements", :url => { :action => "change_entitlements", :id => @person.id }, :before => visual_effect(:slide_up, "entitlements", :duration => 0.5), :complete => visual_effect(:slide_down, "entitlements", :duration => 0.5) ) %> <%= link_to_remote("I''m done changing entitlements", :update => "entitlements", :url => { :action => "show_entitlements", :id => @person.id }, :before => visual_effect(:slide_up, "entitlements", :duration => 0.5), :complete => visual_effect(:slide_down, "entitlements", :duration => 0.5) ) %> And the accompanying controller methods: def change_entitlements @person = Person.find(params[:id]) render(:layout => false) end def show_entitlements @person = Person.find(params[:id]) @ldap_person = @person.ldap_user render :partial => "entitlements", :object => @ldap_person["entitlements"] end Any idea why it might not be behaving correctly? Thanks! Sean