correct handling of data hash parsing
This commit is contained in:
parent
a54e8f3c5e
commit
1f31435a7b
|
@ -77,8 +77,12 @@ class Notification < ActiveRecord::Base
|
||||||
# Be wary of calling this frequently. O(n) JSON parsing can suck.
|
# Be wary of calling this frequently. O(n) JSON parsing can suck.
|
||||||
def data_hash
|
def data_hash
|
||||||
@data_hash ||= begin
|
@data_hash ||= begin
|
||||||
|
|
||||||
return nil if data.blank?
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue