mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 19:08:10 -05:00
correct handling of data hash parsing
This commit is contained in:
parent
a54e8f3c5e
commit
1f31435a7b
1 changed files with 5 additions and 1 deletions
|
@ -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 a new issue