[OSM-dev] 500 errors in rails port due to using .find?

Jon Burgess jburgess777 at googlemail.com
Wed May 16 22:52:06 BST 2007


I've noticed I get 500 API errors due to errors like this where segments
reference nodes IDs which do not exist:

ActiveRecord::RecordNotFound (Couldn't find all Nodes with IDs
(110285,199449,20924,...

This occurs in the following lines in the map API code:
    nodes += Node.find(missing_nodes) if missing_nodes.length > 0
    nodes += Node.find(nodes_to_get) if nodes_to_get.length > 0

This web page explains why this is such a problem and suggests using
find_by_id(id) instead.
http://ragnarson.blogspot.com/2006/07/how-to-avoid-500-server-failure-error.html

I'm new to ruby and rails. I'll try to investigate this further, but
perhaps someone else will beat me to it.

	Jon






More information about the dev mailing list