set modified_by_user=nil instead of breaking if no user is logged in
authorTom Clegg <tom@clinicalfuture.com>
Sat, 9 Feb 2013 08:16:07 +0000 (03:16 -0500)
committerTom Clegg <tom@clinicalfuture.com>
Sat, 9 Feb 2013 08:16:07 +0000 (03:16 -0500)
app/models/orvos_model.rb

index f9bc59d2bed0c160b5ea81509f54a3547670a77e..6feb89108406197a5afcbad36dc041fe432e8ed9 100644 (file)
@@ -82,9 +82,9 @@ class OrvosModel < ActiveRecord::Base
 
   def update_modified_by_fields
     self.created_at ||= Time.now
-    self.owner ||= current_user.uuid
+    self.owner ||= current_user.uuid if current_user
     self.modified_at = Time.now
-    self.modified_by_user = current_user.uuid
+    self.modified_by_user = current_user ? current_user.uuid : nil
     self.modified_by_client = current_api_client ? current_api_client.uuid : nil
   end
 end