]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/search_controller.rb
Replace attr_accessible with strong parameters
[rails.git] / app / controllers / search_controller.rb
index 408b4a6629d93f35c932757bbd5edb9df16928b0..dd7c2febe89a48fc8575a8e359a8f0e7ace5ce7b 100644 (file)
@@ -32,13 +32,13 @@ class SearchController < ApplicationController
 
     if do_nodes
       response.headers['Error'] = "Searching of nodes is currently unavailable"
-      render :nothing => true, :status => :service_unavailable
+      render :text => "", :status => :service_unavailable
       return false
     end
 
     unless value
       response.headers['Error'] = "Searching for a key without value is currently unavailable"
-      render :nothing => true, :status => :service_unavailable
+      render :text => "", :status => :service_unavailable
       return false
     end
 
@@ -48,6 +48,8 @@ class SearchController < ApplicationController
       nodes = nodes.where(:current_node_tags => { :k => type }) if type
       nodes = nodes.where(:current_node_tags => { :v => value }) if value
       nodes = nodes.limit(100)
+    else
+      nodes = Array.new
     end
 
     # Matching for way tags table
@@ -56,6 +58,8 @@ class SearchController < ApplicationController
       ways = ways.where(:current_way_tags => { :k => type }) if type
       ways = ways.where(:current_way_tags => { :v => value }) if value
       ways = ways.limit(100)
+    else
+      ways = Array.new
     end
 
     # Matching for relation tags table
@@ -64,6 +68,8 @@ class SearchController < ApplicationController
       relations = relations.where(:current_relation_tags => { :k => type }) if type
       relations = relations.where(:current_relation_tags => { :v => value }) if value
       relations = relations.limit(2000)
+    else
+      relations = Array.new
     end
 
     # Fetch any node needed for our ways (only have matching nodes so far)