]> git.openstreetmap.org Git - rails.git/commitdiff
Temporary fix for postgres enums pending rails 3.0.4
authorTom Hughes <tom@compton.nu>
Tue, 7 Dec 2010 00:23:37 +0000 (00:23 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 14 Nov 2011 09:42:46 +0000 (09:42 +0000)
app/controllers/application_controller.rb
app/controllers/diary_entry_controller.rb
app/controllers/trace_controller.rb

index e22f64c76a60cb06f1927111d0472cc4268e1b8c..3506b4196fb338537d1c097e7f1c4833c0f1578a 100644 (file)
@@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base
 
   def authorize_web
     if session[:user]
 
   def authorize_web
     if session[:user]
-      @user = User.where(:status => ["active", "confirmed", "suspended"]).find(session[:user])
+      @user = User.where(:id => session[:user]).where("status IN ('active', 'confirmed', 'suspended')").first
 
       if @user.status == "suspended"
         session.delete(:user)
 
       if @user.status == "suspended"
         session.delete(:user)
index 0946c01361ecd012aab60180f82c79c727eee958..b9eb1c2d6a6b24ef1bc6bfa42c323ea3366be0c1 100644 (file)
@@ -114,7 +114,7 @@ class DiaryEntryController < ApplicationController
     @entries = DiaryEntry.includes(:user).order("created_at DESC").limit(20)
 
     if params[:display_name]
     @entries = DiaryEntry.includes(:user).order("created_at DESC").limit(20)
 
     if params[:display_name]
-      user = User.where(:status => ["active", "confirmed"]).find_by_display_name(params[:display_name])
+      user = User.where("status IN ('active', 'confirmed')").find_by_display_name(params[:display_name])
 
       if user
         @entries = @entries.where(:user_id => user.id, :visible => true )
 
       if user
         @entries = @entries.where(:user_id => user.id, :visible => true )
@@ -141,7 +141,7 @@ class DiaryEntryController < ApplicationController
   end
 
   def view
   end
 
   def view
-    user = User.where(:status => ["active", "confirmed"]).find_by_display_name(params[:display_name])
+    user = User.where("status IN ('active', 'confirmed')").find_by_display_name(params[:display_name])
 
     if user
       @entry = DiaryEntry.where(:id => params[:id],
 
     if user
       @entry = DiaryEntry.where(:id => params[:id],
index 1381e71ebb9ccdb4de4bd5051aff542e4a0c6a7c..f381b3243d72a1e0dfa3b3ff1c82b8ff54b260b0 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?
     # 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
       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
   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]})
 
     if params[:display_name]
       traces = traces.where(:users => {:display_name => params[:display_name]})