# Find a way given it's ID, and in a single SQL call also grab its nodes
#
+
# You can't pull in all the tags too unless we put a sequence_id on the way_tags table and have a multipart key
def self.find_eager(id)
- way = Way.find(id, :include => {:way_nodes => :node})
+ way = Way.find(id, :include => [:way_tags, {:way_nodes => :node}])
end
# Find a way given it's ID, and in a single SQL call also grab its nodes and tags
WayNode.delete_all(['id = ?', self.id])
- i = 1
+ sequence = 1
nds.each do |n|
nd = WayNode.new
- nd.id = self.id
+ nd.id = [self.id, sequence]
nd.node_id = n
- nd.sequence_id = i
nd.save!
- i += 1
+ sequence += 1
end
end