Class: Pushkin::Payload

Inherits:
ApplicationRecord show all
Defined in:
app/models/pushkin/payload.rb

Instance Method Summary collapse

Instance Method Details

#dataObject



10
11
12
13
14
# File 'app/models/pushkin/payload.rb', line 10

def data
  value = read_attribute(:data)
  value = value.present? ? JSON.parse(value, symbolize_names: true) : {}
  value
end

#data=(value) ⇒ Object



16
17
18
# File 'app/models/pushkin/payload.rb', line 16

def data=(value)
  write_attribute(:data, value.present? ? value.to_json : value)
end