So I have this code in a migration file ....
create_table :books do |t|
t.column "Title", :string
t.column "Price", :decimal
t.timestamps
end
Are "Title" and :string just parameters being passed to the method
t.column?
If so, I understand that "Title" is a string parameter, what
is :string? a type param?
Thanks
-c
Title : name of the column
string : type of the column. it maps to varchar/varchar2
Similarly for Price
http://api.rubyonrails.com/classes/ActiveRecord/Migration.html
So I have this code in a migration file ....
create_table :books do |t|
t.column "Title", :string
t.column "Price", :decimal
t.timestamps
end
Are "Title" and :string just parameters being passed to the method
t.column?
If so, I understand that "Title" is a string parameter, what
is :string? a type param?
:string is a symbol
see 13 Ways of Looking at a Ruby Symbol | Random Hacks
or has_many :through - Symbols are not pretty strings
Fred