Class: ActiveRecord::TableDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord-postgres-json/activerecord.rb

Instance Method Summary collapse

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)
  options = args.extract_options!
  column_names = args
  column_names.each { |name| column(name, 'json', options) }
end