Class: ActiveRecord::Table
- Inherits:
-
Object
- Object
- ActiveRecord::Table
- 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:
change_table :people do |t|
...
t.json :info
...
end
43 44 45 46 47 |
# File 'lib/activerecord-postgres-json/activerecord.rb', line 43 def json(*args) = args. column_names = args column_names.each { |name| column(name, 'json', ) } end |