'How to access nested attribute in Rails Sql

I have the following Alert object that looks like this:

<Alert
 id:1, 
 message: "{\"body\": "\This is a test.\"}"
>

I'm trying filter the body content from message and set up the following scope:

alert.where("attribute#>>{message, body}` like?", test%")

but I keep getting the error:

Object does not support #inspect

How can I access the body value?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source