]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/trace_controller.rb
Update some more queries to use AREL in place of deprecated methods
[rails.git] / app / controllers / trace_controller.rb
index 1381e71ebb9ccdb4de4bd5051aff542e4a0c6a7c..944335a8f7bda9df0c9af8d4202f769466e8fe01 100644 (file)
@@ -27,7 +27,7 @@ class TraceController < ApplicationController
     # from display name, pick up user id if one user's traces only
     display_name = params[:display_name]
     if !display_name.blank?
-      target_user = User.where(:status => ["active", "confirmed"], :display_name => display_name).first
+      target_user = User.where("status IN ('active', 'confirmed')").where(:display_name => display_name).first
       if target_user.nil?
         @title = t'trace.no_such_user.title'
         @not_found_user = display_name
@@ -214,7 +214,7 @@ class TraceController < ApplicationController
   end
 
   def georss
-    traces = Trace.where(:visibility => [:public, :identifiable])
+    traces = Trace.where("visibility IN ('public', 'identifiable')")
 
     if params[:display_name]
       traces = traces.where(:users => {:display_name => params[:display_name]})
@@ -272,7 +272,7 @@ class TraceController < ApplicationController
   end
 
   def api_read
-    trace = Trace.find(params[:id], :conditions => { :visible => true })
+    trace = Trace.visible.find(params[:id])
 
     if trace.public? or trace.user == @user
       render :text => trace.to_xml.to_s, :content_type => "text/xml"
@@ -282,7 +282,7 @@ class TraceController < ApplicationController
   end
 
   def api_update
-    trace = Trace.find(params[:id], :conditions => { :visible => true })
+    trace = Trace.visible.find(params[:id])
 
     if trace.user == @user
       new_trace = Trace.from_xml(request.raw_post)
@@ -303,7 +303,7 @@ class TraceController < ApplicationController
   end
 
   def api_delete
-    trace = Trace.find(params[:id], :conditions => { :visible => true })
+    trace = Trace.visible.find(params[:id])
 
     if trace.user == @user
       trace.visible = false