1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Added example of using shorthand in create_table.

This commit is contained in:
Ryan Bigg 2009-06-22 15:02:37 +10:00
parent 3009fcffa5
commit f73ee375a6

View file

@ -41,11 +41,19 @@ module ActiveRecord
# # create_table() passes a TableDefinition object to the block. # # create_table() passes a TableDefinition object to the block.
# # This form will not only create the table, but also columns for the # # This form will not only create the table, but also columns for the
# # table. # # table.
#
# create_table(:suppliers) do |t| # create_table(:suppliers) do |t|
# t.column :name, :string, :limit => 60 # t.column :name, :string, :limit => 60
# # Other fields here # # Other fields here
# end # end
# #
# === Block form, with shorthand
# # You can also use the column types as method calls, rather than calling the column method.
# create_table(:suppliers) do |t|
# t.string :name, :limit => 60
# # Other fields here
# end
#
# === Regular form # === Regular form
# # Creates a table called 'suppliers' with no columns. # # Creates a table called 'suppliers' with no columns.
# create_table(:suppliers) # create_table(:suppliers)