Improved device logging.
This commit is contained in:
parent
0917cec855
commit
6d7124a169
3 changed files with 12 additions and 3 deletions
|
@ -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')
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
|
|
9
db/migrate/20150817000002_update_user_devices.rb
Normal file
9
db/migrate/20150817000002_update_user_devices.rb
Normal 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
|
Loading…
Reference in a new issue