sql - Query sqlite hash column in Rails -


i have column in table saved hash , i'm trying use sql query column find records. far can return records using query found. so, how expand upon able find records parameters id and provider? also, there tutorial on how use sql queries in rails?

<publicactivity::activity id: 233, trackable_id: 2, trackable_type: "user",  owner_id: 2,  owner_type: "user", key: "like", parameters: {:id=>"27", :provider=>nil},  recipient_id: 3, recipient_type: "user", created_at: "2016-01-16 18:26:27",  updated_at: "2016-01-16 18:26:27", read: false, user_recipients: nil> 

this query.

publicactivity::activity.where("parameters ?", "%id%") 

also, when try this

publicactivity::activity.where("parameters.id ?", "%27%") 

i error

sqlite3::sqlexception: no such column: parameters.id: select "activities".* "activities"  (parameters.id '%27%') 

what about?:

activity.all.parameters.where('id ? , provider ?', '%#{id}%', '%#{provider}%') 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -