Hi,
I have a simple example in Rails 2.1.2, 2.2.2 using the auto_complete
plugin. It works wonderfully. However, I was wondering how it would
handle errors. For example, if for some reason a person couldn't be
found, the HTTP request will come back with a 404
def auto_complete_for_people_foo
# Cause a deliberate error
people = Person.find(22222) # doesn't exist
. . .
end
Or there might be a syntax error in the code and we get a 500 error
back.
def auto_complete_for_people_foo
# Cause a deliberate error
asflksajflasjlf # Not valid Ruby
code
. . .
end
For other AJAX functionality in our application (e.g. form_remote_tag)
we have global AJAX repsonders as follows:
Ajax.Responders.register({
onComplete: function(transport) {
console.info("COMPLETE");
Element.hide('spinner');
if (transport.transport.status == 0 ||
transport.transport.status ==
12029) {
// Lost connection as reported in Firefox (0) or IE
(12029)
alert("The connection with the server has been lost.");
console.info("LOST CONNECTION");
} else if (transport.transport.status != 200 ) {
alert(String.format("The server has reported an error
with code
{0}", transport.transport.status));
console.info("ERROR");
}
},
onCreate: function() {
Element.show('spinner');
console.info("LOADING...");
}
});
For auto_complete, the onCreate callback gets invoked, but the
onComplete one never does. I've checked this in Firebug - I can see
the 404 or 500 POST errors, but I the
Does anyone have any ideas or areas they can point me to?
TIA
Cam.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---