Last active
February 4, 2018 16:34
-
-
Save mohitmun/9f29a4a3242a4ac68463e1f44732ebd7 to your computer and use it in GitHub Desktop.
find_by equivaltent for json datatype
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def self.find_byjs(hash) | |
| User.where("(json_store ->> '#{hash.keys.first}') = ?", hash.values.first).last | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment