ruby on rails sql_type - A reminder for me

| | Comments (0)

I treated myself to a rails training course last weekend (with Well House Consultants, rather good, I'll write about it if I get around to it). Immediately I start to create my first ruby app and I forget all the sqltypes I can use in my Model and where to look them up. As I think I'll be looking them up quite a lot, I've put them here on my blog for my later reference

:primary_key,
:string,
:text,
:integer,
:float,
:decimal,
:datetime,
:timestamp
:time,
:date,
:binary,
:boolean.

Options that I can use in my migration
I must remember to specify the decimal precision I need!
:precision [1..63], :scale [0..30]. Otherwise Mysql Default is (10,0).

* :limit - Requests a maximum column length. This is number of characters for :string and :text columns and number of bytes for :binary and :integer columns.
* :default - The column's default value. Use nil for NULL.
* :null - Allows or disallows NULL values in the column. This option could have been named :null_allowed.
* :precision - Specifies the precision for a :decimal column.
* :scale - Specifies the scale for a :decimal column.


These came from: http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/TableDefinition.html

Leave a comment

About this Entry

This page contains a single entry by Steve published on February 4, 2010 3:46 PM.

View a Multi page tiff file in windows was the previous entry in this blog.

Memories of Nan Root is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

 

Powered by Movable Type 4.31-en