mardi 24 janvier 2017

How to query from rails console?

In rails console

Item.last 

gives me this result.

=> #<Item id: 1484767245888254, 
            partnum: ["xyz", "abc", "efg"], 
            display_port: nil, 
            able_id: 1484767244590695, 
            able_type: "money">

Suppose to query the record with

able_type = "money" 

we can do

Item.where(able_type: "money")

But, How to query the above result if i know the partnum which is "xyz" (there is a array of string in partnum).

Aucun commentaire:

Enregistrer un commentaire