Prev | Current Page 527 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"


Public Instance Methods
[](name)
Use this method to return a ColumnDefinition for the column with the specified name.
column(name, type, options = {})
This column method instantiates a new column with the specified name for the table, returning
the TableDefinition instance on which the column method was called. Valid values for the
type parameter are :primary_key, :string, :text, :integer, :float, :decimal, :datetime,
:timestamp, :time, :date, :binary, and :boolean.
The available options are :limit, :default, :null, :precision, and :scale. None of the
options have a default value.
The :limit option specifies the maximum length for values in the column. This option is
only valid for columns of type :string, :text, :binary, and :integer.
The :default option specifies the default value of this database column. Specifying
:default => nil will result in a default of NULL.
The :null option, either true or false, specifies whether NULL values should be allowed in
this database column.
The :precision option specifies the precision of the database column.


Pages:
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539