Skip to content
Browse files

Merge pull request #16780 from viditn91/use-correct-operators-in-query

use correct operator in query based on JSON document [ci skip]
  • Loading branch information...
2 parents ea1a028 + 6d988e2 commit f6d3af4fa7e6dea228475ac142fa28288807fcc9 @senny senny committed Sep 3, 2014
Showing with 2 additions and 1 deletion.
  1. +2 −1 guides/source/active_record_postgresql.md
View
3 guides/source/active_record_postgresql.md
@@ -132,7 +132,8 @@ event = Event.first
event.payload # => {"kind"=>"user_renamed", "change"=>["jack", "john"]}
## Query based on JSON document
-Event.where("payload->'kind' = ?", "user_renamed")
+# The -> operator returns the original JSON type (which might be an object), whereas ->> returns text
+Event.where("payload->>'kind' = ?", "user_renamed")
```
### Range Types

0 comments on commit f6d3af4

Please sign in to comment.
Something went wrong with that request. Please try again.