correct handling of data hash parsing

This commit is contained in:
Sam 2015-09-04 13:34:21 +10:00
parent a54e8f3c5e
commit 1f31435a7b

View File

@ -77,8 +77,12 @@ class Notification < ActiveRecord::Base
# Be wary of calling this frequently. O(n) JSON parsing can suck.
def data_hash
@data_hash ||= begin
return nil if data.blank?
JSON.parse(data).with_indifferent_access
parsed = JSON.parse(data)
return nil if parsed.blank?
parsed.with_indifferent_access
end
end