cirandas.net

ref: master

plugins/push_notification/lib/device_token.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
class PushNotificationPlugin::DeviceToken < ApplicationRecord
  belongs_to :user
  attr_accessible :token, :device_name, :user

  after_save :check_notification_settings

  private

  def check_notification_settings
    if user.notification_settings.nil?
      user.notification_settings=PushNotificationPlugin::NotificationSettings.new
      user.save
    end
  end

end