use find() instead of where() to get a single object
authorTom Clegg <tom@clinicalfuture.com>
Wed, 17 Jul 2013 19:04:39 +0000 (15:04 -0400)
committerTom Clegg <tom@clinicalfuture.com>
Wed, 17 Jul 2013 19:04:39 +0000 (15:04 -0400)
apps/workbench/app/controllers/application_controller.rb

index 3da3faadccbc0e5f943cf82d7e459a2ba4c7d148..99bcbe40dd2c60a131b10f8b69fffddd424cb2e4 100644 (file)
@@ -123,7 +123,11 @@ class ApplicationController < ActionController::Base
     if params[:id] and params[:id].match /\D/
       params[:uuid] = params.delete :id
     end
-    @object = model_class.where(uuid: params[:uuid]).first
+    if params[:uuid].is_a? String
+      @object = model_class.find(params[:uuid])
+    else
+      @object = model_class.where(uuid: params[:uuid]).first
+    end
   end
 
   def thread_clear