]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/changeset_controller.rb
Make changeset#query preload users, tags and comments
[rails.git] / app / controllers / changeset_controller.rb
index 898afae4a30de945a7d5e338c0b4c93b8c8643b1..8fbbe1362605992668f143909d89d88a83f83550 100644 (file)
@@ -216,6 +216,12 @@ class ChangesetController < ApplicationController
     changesets = conditions_closed(changesets, params["closed"])
     changesets = conditions_ids(changesets, params["changesets"])
 
     changesets = conditions_closed(changesets, params["closed"])
     changesets = conditions_ids(changesets, params["changesets"])
 
+    # sort and limit the changesets
+    changesets = changesets.order("created_at DESC").limit(100)
+
+    # preload users, tags and comments
+    changesets = changesets.preload(:user, :changeset_tags, :comments)
+
     # create the results document
     results = OSM::API.new.get_xml_doc
 
     # create the results document
     results = OSM::API.new.get_xml_doc