From ad08072249f85732abe4de408a0316c6b7bfaa99 Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Mon, 18 Jan 2016 11:29:36 +0530 Subject: Explain how HStore columns can be queried [ci skip] - Fixes #22876. --- guides/source/active_record_postgresql.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'guides') diff --git a/guides/source/active_record_postgresql.md b/guides/source/active_record_postgresql.md index b592209d4b..68c6a77882 100644 --- a/guides/source/active_record_postgresql.md +++ b/guides/source/active_record_postgresql.md @@ -84,6 +84,7 @@ Book.where("array_length(ratings, 1) >= 3") ### Hstore * [type definition](http://www.postgresql.org/docs/current/static/hstore.html) +* [functions and operators](http://www.postgresql.org/docs/current/static/hstore.html#AEN167712) NOTE: You need to enable the `hstore` extension to use hstore. @@ -108,6 +109,9 @@ profile.settings # => {"color"=>"blue", "resolution"=>"800x600"} profile.settings = {"color" => "yellow", "resolution" => "1280x1024"} profile.save! + +Profile.where("settings->'color' = ?", "yellow") +#=> #"yellow", "resolution"=>"1280x1024"}>]> ``` ### JSON -- cgit v1.2.3