- check_boundaries(@min_lon, @min_lat, @max_lon, @max_lat, :false)
-
- @bugs = MapBug.find_by_area_no_quadtile(@min_lat, @min_lon, @max_lat, @max_lon, :include => :map_bug_comment, :order => "last_changed DESC", :limit => limit, :conditions => conditions)
-
- respond_to do |format|
- format.html {render :template => 'map_bugs/get_bugs.js', :content_type => "text/javascript"}
- format.rss {render :template => 'map_bugs/get_bugs.rss'}
- format.js
- format.xml {render :template => 'map_bugs/get_bugs.xml'}
- format.json { render :json => @bugs.to_json(:methods => [:lat, :lon], :only => [:id, :status, :date_created], :include => { :map_bug_comment => { :only => [:commenter_name, :date_created, :comment]}}) }
-# format.gpx {render :template => 'map_bugs/get_bugs.gpx'}
- end
+ check_boundaries(@min_lon, @min_lat, @max_lon, @max_lat, MAX_BUG_REQUEST_AREA)
+
+ @bugs = MapBug.find_by_area(@min_lat, @min_lon, @max_lat, @max_lon, :include => :comments, :order => "updated_at DESC", :limit => limit, :conditions => conditions)
+
+ respond_to do |format|
+ format.html {render :template => 'map_bugs/get_bugs.js', :content_type => "text/javascript"}
+ format.rss {render :template => 'map_bugs/get_bugs.rss'}
+ format.js
+ format.xml {render :template => 'map_bugs/get_bugs.xml'}
+ format.json { render :json => @bugs.to_json(:methods => [:lat, :lon], :only => [:id, :status, :created_at], :include => { :comments => { :only => [:author_name, :created_at, :body]}}) }
+ format.gpx {render :template => 'map_bugs/get_bugs.gpx'}
+ end