Class: ActiveRecord::ConnectionAdapters::Table
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::Table
- Defined in:
- lib/activerecord-postgres-json/activerecord.rb
Instance Method Summary collapse
-
#json(*args) ⇒ Object
Adds json type for migrations.
- #jsonb(*args) ⇒ Object
Instance Method Details
#json(*args) ⇒ Object
Adds json type for migrations. So you can add columns to a table like:
change_table :people do |t|
...
t.json :info
...
end
82 83 84 85 86 |
# File 'lib/activerecord-postgres-json/activerecord.rb', line 82 def json(*args) = args. column_names = args column_names.each { |name| column(name, 'json', ) } end |
#jsonb(*args) ⇒ Object
88 89 90 91 92 |
# File 'lib/activerecord-postgres-json/activerecord.rb', line 88 def jsonb(*args) = args. column_names = args column_names.each { |name| column(name, 'jsonb', ) } end |