diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-06-27 13:24:57 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-27 13:24:57 -0400 |
commit | d9cda9aa3574379d1c53d5b9116c88c7a1d8a0d6 (patch) | |
tree | dfe27536918b4ac979bbb05f3885e6b445e7f8e6 /guides/source | |
parent | 1eaed91b122f3c525fa51c955f409038e2804b91 (diff) | |
parent | 927e98621983d33795a99434492c3bb8ee7cd764 (diff) | |
download | rails-d9cda9aa3574379d1c53d5b9116c88c7a1d8a0d6.tar.gz rails-d9cda9aa3574379d1c53d5b9116c88c7a1d8a0d6.tar.bz2 rails-d9cda9aa3574379d1c53d5b9116c88c7a1d8a0d6.zip |
Merge pull request #29586 from padi/add_docs_for_postgresql_jsonb_datatype_in_ar
Document ActiveRecord's PostgreSQL-specific support for JSONB datatype
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/active_record_postgresql.md | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/guides/source/active_record_postgresql.md b/guides/source/active_record_postgresql.md index 041fdacbab..8543fcd20f 100644 --- a/guides/source/active_record_postgresql.md +++ b/guides/source/active_record_postgresql.md @@ -114,16 +114,21 @@ Profile.where("settings->'color' = ?", "yellow") # => #<ActiveRecord::Relation [#<Profile id: 1, settings: {"color"=>"yellow", "resolution"=>"1280x1024"}>]> ``` -### JSON +### JSON and JSONB * [type definition](http://www.postgresql.org/docs/current/static/datatype-json.html) * [functions and operators](http://www.postgresql.org/docs/current/static/functions-json.html) ```ruby # db/migrate/20131220144913_create_events.rb +# ... for json datatype: create_table :events do |t| t.json 'payload' end +# ... or for jsonb datatype: +create_table :events do |t| + t.jsonb 'payload' +end # app/models/event.rb class Event < ApplicationRecord |