Forum: Ruby on Rails Database Migration error

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.
C9c80a433227bf2dc2a6cfb4893857e1?d=identicon&s=25 Doel Sengupta (doelsengupta)
on 2009-03-27 08:42
This is my first post to the forum,
when I try to run a migration that has a t.column, I get this:

rake aborted!
undefined method `column' for
#<ActiveRecord::ConnectionAdapters::TableDefinition:0x487c194>
5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2009-03-27 12:17
(Received via mailing list)
Can you supply some more code please, assuming it is not hundreds of
lines
then show us the migration .rb contents.

2009/3/27 Doel Sengupta <rails-mailing-list@andreas-s.net>
40db9e75b3f5899258e3bdc0c9210154?d=identicon&s=25 Conrad Taylor (conradwt)
on 2009-03-27 12:39
(Received via mailing list)
On Fri, Mar 27, 2009 at 4:15 AM, Colin Law <clanlaw@googlemail.com>
wrote:

>> undefined method `column' for
>> #<ActiveRecord::ConnectionAdapters::TableDefinition:0x487c194>
>> --
>> Posted via http://www.ruby-forum.com/.
>>
>>
>>
Which version of Rails are you using?

-Conrad
C9c80a433227bf2dc2a6cfb4893857e1?d=identicon&s=25 Doel Sengupta (doelsengupta)
on 2009-03-31 14:03
Colin Law wrote:
> Can you supply some more code please, assuming it is not hundreds of
> lines
> then show us the migration .rb contents.
>
> 2009/3/27 Doel Sengupta <rails-mailing-list@andreas-s.net>

I got it fixed by changing t.column to t.<datatype> in my model.rb file
C9c80a433227bf2dc2a6cfb4893857e1?d=identicon&s=25 Doel Sengupta (doelsengupta)
on 2009-03-31 14:03
Conrad Taylor wrote:
> On Fri, Mar 27, 2009 at 4:15 AM, Colin Law <clanlaw@googlemail.com>
> wrote:
>
>>> undefined method `column' for
>>> #<ActiveRecord::ConnectionAdapters::TableDefinition:0x487c194>
>>> --
>>> Posted via http://www.ruby-forum.com/.
>>>
>>>
>>>
> Which version of Rails are you using?
>
> -Conrad

Rails 2.0.2
D188e591eac11021329b8821a5f954c7?d=identicon&s=25 Ar Chron (railsdog)
on 2009-03-31 15:36
Doel Sengupta wrote:
> I got it fixed by changing t.column to t.<datatype> in my model.rb file

You might have been mixing syntaxes:

t.column :first_name, :string

or

t.string :first_name

will work
This topic is locked and can not be replied to.