Sha256: 06fa51ffef6552cd55f291553182ab6e98c6e94c410f250dc87e7701a167f2f8
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
module OneSignalUser extend ActiveSupport::Concern included do before_action :set_onesignal_user helper_method :current_onesignal end def current_onesignal current_onesignal[:id] = cookies[:oneSignalUserId] current_onesignal[:permission] = cookies[:oneSignalUserPermission] current_onesignal[OneSignalUser::Configuration.devise_class.downcase.to_sym] = OneSignalUser::Configuration.devise_class.constantize&.find_by(onesignal_id: current_onesignal[:id]) if cookies.has_key?(:oneSignalUserId) current_onesignal end private def set_onesignal_user if current_user onesignal_user_id = cookies[:oneSignalUserId] if onesignal_user_id.nil? current_user.update_attributes onesignal_id: nil, onesignal_permission: nil else current_user.update_attributes onesignal_id: onesignal_user_id, onesignal_permission: cookies[:oneSignalUserPermission] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
devise-onesignal-1.0.0 | app/controllers/concerns/one_signal_user.rb |