[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

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.

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


More information about the dev mailing list