我正在使用ahoygem 进行分析。在ahoy_events表中,我有properties一列 json 数据类型。我想根据该列查找特定数据。
假设我有
{"tag":"a","class":"bigyapan-6","page":"/client/dashboard","text":"","href":"http://www.google.com"}
这作为数据,我想 find_by 类。
在rails c我跑了Ahoy::Event.find_by(properties[:class]: "bigyapan-6"),它给了我一个错误
Ahoy::Event.find_by(properties["class"]: "bigyapan-6")
SyntaxError: unexpected ')', expecting end-of-input