Sha256: b2e4b14cfa7c4913547e3cee994397ac4b6f19f2e5f20287776952fc50f45152
Contents?: true
Size: 853 Bytes
Versions: 4
Compression:
Stored size: 853 Bytes
Contents
module DeviseOnesignal module DeviceConcern extend ActiveSupport::Concern extend DeviseOnesignal::DeviceHelper included do before_action :set_device end private def set_device unless cookies[:oneSignalPlayerId].nil? onesignal_player_id = cookies[:oneSignalPlayerId] device = Device.find_or_create_by! onesignal_id: onesignal_player_id device.onesignal_permission = cookies[:oneSignalPlayerPermission] device.last_used = Time.now device.owner = ApplicationController.try(:set_device_owner) || set_device_owner device.save! end end def set_device_owner current_user if current_user end end end
Version data entries
4 entries across 4 versions & 1 rubygems