Skip to content

Commit

Permalink
use correct operator in query based on JSON document
Browse files Browse the repository at this point in the history
  • Loading branch information
viditn91 committed Sep 2, 2014
1 parent a2f8377 commit 6d988e2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion guides/source/active_record_postgresql.md
Expand Up @@ -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
Expand Down

0 comments on commit 6d988e2

Please sign in to comment.