Improved device logging.

This commit is contained in:
Martin Edenhofer 2015-08-17 17:16:17 +02:00
parent 0917cec855
commit 6d7124a169
3 changed files with 12 additions and 3 deletions

View file

@ -9,7 +9,7 @@ class UserDevicesController < ApplicationController
devices.each {|device|
attributes = device.attributes
if device.location_details['city']
attributes['country'] += ", #{device.location_details['city']}"
attributes['location'] += ", #{device.location_details['city']}"
end
attributes.delete('created_at')
attributes.delete('device_details')

View file

@ -46,7 +46,7 @@ store device for user
:user_id => user_id,
os: browser[:plattform],
browser: browser[:name],
country: country,
location: country,
)
if exists
@ -60,7 +60,7 @@ store device for user
name: name,
os: browser[:plattform],
browser: browser[:name],
country: country,
location: country,
device_details: browser,
location_details: location,
)

View file

@ -0,0 +1,9 @@
class UpdateUserDevices < ActiveRecord::Migration
def up
add_column :user_devices, :location, :string, limit: 150, null: true
remove_column :user_devices, :country
add_index :user_devices, [:os, :browser, :location]
UserDevice.reset_column_information
end
end