Prev | Current Page 523 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"

column :first_name, :string
t.column :last_name, :string
t.column :email, :string
end
The valid options for the options hash are :id, :primary_key, :options, :temporary, and
:force.
The :id option, which defaults to true, specifies whether the primary key column should
be added to the table automatically.
The :primary_key option, which defaults to :id, specifies the name of the primary key
column in the table.
The :options option specifies any additional options that you wish to append to the table definition.
For instance, if you are using aMySQL database and wish to use an InnoDB table and to set
the default character set of the table to be UTF-8, you would specify :options => 'ENGINE=InnoDB
DEFAULT CHARSET=utf8'.
The :temporary option defaults to false; if set to true, it indicates that this table should
be a temporary table.
The :force option defaults to false; if set to true, it indicates that the table should be
dropped before attempting to create it.
distinct(columns, order_by)
distinct executes a SELECT DISTINCT SQL statement, with the given ORDER BY clause for the
given set of columns.


Pages:
511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535