vendredi 17 avril 2015

Matching ActiveRecord::Store columns in database

Hi There I am have a model named User, I am storing a hash to the user model in attribute params, I have declared this column as store in my user model without any accessor, while saving data to database it works Quite fine. but I have to retrieve data by certain criteria.


Say I have stored a user Object with params field as { checked: true } and Other by { checked: true }


Now I have to retrieve user having params: { checked: true}


the Query I am using is:



User.where(params: {"checked" => true});


This is Throwing Error as:



INTERNAL ERROR!!! SQLite3::SQLException: no such column: params.checked: SELECT "users".* FROM "users" WHERE "params"."checked" = 't'


I searched a Ton about comparing two store columns in database but not found related stuff.


Thanks In Advance


Aucun commentaire:

Enregistrer un commentaire