Forum: Ruby on Rails Explain this migrate line?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
typemismatch (Guest)
on 2009-01-19 05:06
(Received via mailing list)
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
Shiv N Gautam (Guest)
on 2009-01-19 05:32
(Received via mailing list)
Title : name of the column
string : type of the column. it maps to varchar/varchar2

Similarly for Price

http://api.rubyonrails.com/classes/ActiveRecord/Mi...

--
Shiv N Gautam

On Mon, Jan 19, 2009 at 8:35 AM, typemismatch 
<removed_email_address@domain.invalid>
wrote:

> t.column?
>
> If so, I understand that "Title" is a string parameter, what
> is :string? a type param?
>
> Thanks
> -c
>
> >
>


--

E. B. White  - "Genius is more often found in a cracked pot than in a
whole
one."
Frederick C. (Guest)
on 2009-01-19 13:30
(Received via mailing list)
On 19 Jan 2009, at 03:05, typemismatch wrote:

> t.column?
>
> If so, I understand that "Title" is a string parameter, what
> is :string? a type param?

:string is a symbol
see
http://www.randomhacks.net/articles/2007/01/20/13-...
  or
http://blog.hasmanythrough.com/2008/4/19/symbols-a...

Fred
This topic is locked and can not be replied to.