:binary
:boolean
:date
:datetime
:decimal
:float
:integer
:bigint
:primary_key
:references
:string
:text
:time
:timestamp
Source: http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-add_column
These are the same as with Rails 3.
If you use PostgreSQL, you can also take advantage of these:
:hstore
:json
:array
:cidr_address
:ip_address
:mac_address
They are stored as strings if you run your app with a not-PostgreSQL database.
注意: Mysql 不支持数值型type
文献题目 | 去谷歌学术搜索 | ||||||||||
Rails#rails activerecord type | |||||||||||
文献作者 | ruby on rails | ||||||||||
文献发表年限 | 2017 | ||||||||||
文献关键字 | |||||||||||
rails; type | |||||||||||
摘要描述 | |||||||||||
Rails 在建表时支持的属性类型 |