Class: ActiveRecord::TableDefinition
- Inherits:
-
Object
- Object
- ActiveRecord::TableDefinition
- Defined in:
- lib/activerecord-postgres-json/activerecord.rb
Instance Method Summary collapse
-
#json(*args) ⇒ Object
Adds json type for migrations.
Instance Method Details
#json(*args) ⇒ Object
Adds json type for migrations. So you can add columns to a table like:
create_table :people do |t|
...
t.json :info
...
end
27 28 29 30 31 |
# File 'lib/activerecord-postgres-json/activerecord.rb', line 27 def json(*args) = args. column_names = args column_names.each { |name| column(name, 'json', ) } end |