Browse Source

Force update, also if no other attribute has changed.

Martin Edenhofer 9 years ago
parent
commit
b75724450b
2 changed files with 5 additions and 1 deletions
  1. 4 1
      app/controllers/application_controller.rb
  2. 1 0
      app/models/user_device.rb

+ 4 - 1
app/controllers/application_controller.rb

@@ -113,7 +113,10 @@ class ApplicationController < ActionController::Base
     end
 
     # check if entry exists / only if write action
-    return if request.method == 'GET' || request.method == 'OPTIONS'
+    method = request.method
+    return if method == 'GET'
+    return if method == 'OPTIONS'
+    return if method == 'HEAD'
 
     # only update if needed
     return if session[:user_device_update_at] && session[:user_device_update_at] > Time.zone.now - 5.minutes

+ 1 - 0
app/models/user_device.rb

@@ -145,6 +145,7 @@ log user device action
     end
 
     # update attributes
+    user_device.updated_at = Time.zone.now # force update, also if no other attribute has changed
     user_device.save
     user_device
   end