Sha256: 2e259865a9f9b2aa3bc54e1010ea24ea57b6b35d99bde783fd54d800e7c38d1d
Contents?: true
Size: 1.18 KB
Versions: 19
Compression:
Stored size: 1.18 KB
Contents
module Rpush module Client module ActiveRecord class Notification < ::ActiveRecord::Base include Rpush::MultiJsonHelper include Rpush::Client::ActiveModel::Notification self.table_name = 'rpush_notifications' serialize :registration_ids serialize :url_args belongs_to :app, class_name: 'Rpush::Client::ActiveRecord::App' def data=(attrs) return unless attrs fail ArgumentError, 'must be a Hash' unless attrs.is_a?(Hash) write_attribute(:data, multi_json_dump(attrs.merge(data || {}))) end def notification=(attrs) return unless attrs fail ArgumentError, 'must be a Hash' unless attrs.is_a?(Hash) write_attribute(:notification, multi_json_dump(attrs.merge(data || {}))) end def registration_ids=(ids) ids = [ids] if ids && !ids.is_a?(Array) super end def data multi_json_load(read_attribute(:data)) if read_attribute(:data) end def notification multi_json_load(read_attribute(:notification)) if read_attribute(:notification) end end end end end
Version data entries
19 entries across 19 versions & 2 rubygems