# Rails: database connection

**URL:** <https://www.ruby-forum.com/t/rails-database-connection/154660>\
**Category:** Rails\
**Created:** [December 2, 2008, 6:35pm UTC](https://www.ruby-forum.com/t/rails-database-connection/154660 "2008-12-02T18:35:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![geneeyuss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e495f1/32.png) [@geneeyuss](https://www.ruby-forum.com/u/geneeyuss)\
**Post date:** [December 2, 2008, 6:35pm UTC](https://www.ruby-forum.com/t/rails-database-connection/154660/1 "2008-12-02T18:35:07Z")

</div>

I have been using rails to talk to MySQL. I followed the below tutorial  
and I have been getting erros on using rake db:migrate. Could some let  
me know how to resolve it.

Tutorial:

> **[lawrencepit.com](http://blog.lawrencepit.com/2008/07/19/sproutcore-rails/)**
>
> This domain may be for sale!

# Error: srilatha-bhuvanapallis-macbook-pro:contacts Latha$ rake db:migrate (in /Users/Latha/LearningRuby/contacts) == CreateContacts: migrating

– create\_table(:contacts)  
rake aborted!  
undefined method `string’ for  
#ActiveRecord::ConnectionAdapters::TableDefinition:0x2289248

(See full trace by running task with --trace)

I dont see a solution to this problem. I would appreciate if someone  
could provide me a solution to this.

Thanks  
Latha

---

<div class="post-metadata">

**Author:** ![geneeyuss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e495f1/32.png) [@geneeyuss](https://www.ruby-forum.com/u/geneeyuss)\
**Post date:** [December 2, 2008, 6:48pm UTC](https://www.ruby-forum.com/t/rails-database-connection/154660/2 "2008-12-02T18:48:39Z")

</div>

On 2 Dec 2008, at 17:35, Srilatha Bhuvanapalli wrote:

> I have been using rails to talk to MySQL. I followed the below  
> tutorial  
> and I have been getting erros on using rake db:migrate. Could some let  
> me know how to resolve it.

Sounds like you’re using a version of rails older than 2.0

Fred

---

<div class="post-metadata">

**Author:** ![geneeyuss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e495f1/32.png) [@geneeyuss](https://www.ruby-forum.com/u/geneeyuss)\
**Post date:** [December 2, 2008, 6:50pm UTC](https://www.ruby-forum.com/t/rails-database-connection/154660/3 "2008-12-02T18:50:55Z")

</div>

Frederick C. wrote:

> On 2 Dec 2008, at 17:35, Srilatha Bhuvanapalli wrote:
> 
> > I have been using rails to talk to MySQL. I followed the below  
> > tutorial  
> > and I have been getting erros on using rake db:migrate. Could some let  
> > me know how to resolve it.
> 
> Sounds like you’re using a version of rails older than 2.0
> 
> Fred

My version of rails is 2.1.2  
srilatha-bhuvanapallis-macbook-pro:contacts Latha$ rails -v  
Rails 2.1.2

---

<div class="post-metadata">

**Author:** ![geneeyuss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e495f1/32.png) [@geneeyuss](https://www.ruby-forum.com/u/geneeyuss)\
**Post date:** [December 2, 2008, 6:57pm UTC](https://www.ruby-forum.com/t/rails-database-connection/154660/4 "2008-12-02T18:57:27Z")

</div>

On 2 Dec 2008, at 17:50, Srilatha Bhuvanapalli wrote:

> > > 
> > 
> > Sounds like you’re using a version of rails older than 2.0
> > 
> > Fred
> 
> My version of rails is 2.1.2  
> srilatha-bhuvanapallis-macbook-pro:contacts Latha$ rails -v  
> Rails 2.1.2

but is that app set to use an old version of rails (eg because it’s  
frozen into vendor/rails or because RAILS\_GEM\_VERSION is set ) ?  
And of course seeing the actual code producing an error always helps.

---

<div class="post-metadata">

**Author:** ![geneeyuss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e495f1/32.png) [@geneeyuss](https://www.ruby-forum.com/u/geneeyuss)\
**Post date:** [December 2, 2008, 7:11pm UTC](https://www.ruby-forum.com/t/rails-database-connection/154660/5 "2008-12-02T19:11:33Z")

</div>

On 2 Dec 2008, at 18:04, Srilatha Bhuvanapalli wrote:

> > > srilatha-bhuvanapallis-macbook-pro:contacts Latha$ rails -v  
> > > Rails 2.1.2
> > 
> > but is that app set to use an old version of rails (eg because it’s  
> > frozen into vendor/rails or because RAILS\_GEM\_VERSION is set ) ?  
> > And of course seeing the actual code producing an error always helps.
> 
> Could I please how to check if my app to set to old version of rails?

The easiest way is to run script/console or script/server - they will  
tell you what version of rails is being used.

---

<div class="post-metadata">

**Author:** ![geneeyuss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e495f1/32.png) [@geneeyuss](https://www.ruby-forum.com/u/geneeyuss)\
**Post date:** [December 2, 2008, 7:04pm UTC](https://www.ruby-forum.com/t/rails-database-connection/154660/6 "2008-12-02T19:04:05Z")

</div>

Frederick C. wrote:

> On 2 Dec 2008, at 17:50, Srilatha Bhuvanapalli wrote:
> 
> > > > 
> > > 
> > > Sounds like you’re using a version of rails older than 2.0
> > > 
> > > Fred
> > 
> > My version of rails is 2.1.2  
> > srilatha-bhuvanapallis-macbook-pro:contacts Latha$ rails -v  
> > Rails 2.1.2
> 
> but is that app set to use an old version of rails (eg because it’s  
> frozen into vendor/rails or because RAILS\_GEM\_VERSION is set ) ?  
> And of course seeing the actual code producing an error always helps.

Could I please how to check if my app to set to old version of rails?

Below is my database.yml file:

# MySQL (default setup). Versions 4.1 and 5.0 are recommended.

# 

# Install the MySQL driver:

# gem install mysql

# On MacOS X:

# gem install mysql – --include=/usr/local/lib

# On Windows:

# gem install mysql

# Choose the win32 build.

# Install MySQL and put its /bin directory on your path.

# 

# And be sure to use new-style password hashing:

# [http://dev.mysql.com/doc/refman/5.0/en/old-client.html](http://dev.mysql.com/doc/refman/5.0/en/old-client.html)

development:  
adapter: mysql  
database: addressnote  
username: root  
password: changeme  
socket: /tmp/mysql.sock

# Warning: The database defined as ‘test’ will be erased and

# re-generated from your development database when you run ‘rake’.

# Do not set this db to the same as development or production.

test:  
adapter: mysql  
database: addressnote\_test  
username: root  
password:  
socket: /tmp/mysql.sock

production:  
adapter: mysql  
database: addressnote\_production  
username: root  
password:  
socket: /tmp/mysql.sock

Any help would be appreciated.

Thanks  
Latha

---

<div class="post-metadata">

**Author:** ![geneeyuss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e495f1/32.png) [@geneeyuss](https://www.ruby-forum.com/u/geneeyuss)\
**Post date:** [December 2, 2008, 7:35pm UTC](https://www.ruby-forum.com/t/rails-database-connection/154660/7 "2008-12-02T19:35:39Z")

</div>

On 2 Dec 2008, at 18:15, Srilatha Bhuvanapalli wrote:

> > > > helps.
> > > 
> > > Could I please how to check if my app to set to old version of  
> > > rails?
> > 
> > The easiest way is to run script/console or script/server - they will  
> > tell you what version of rails is being used.
> 
> Below is what I get when I run script/server:

It doesn’t - newer versions would tell you which already tells you  
that you’re probably not running 2.1.2.  
ruby script/console might still tell you (I can’t remember when they  
started showing versions)

And like I said before check if your environment.rb sets  
RAILS\_GEM\_VERSION or if vendor/rails is present.

Fred

---

<div class="post-metadata">

**Author:** ![geneeyuss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e495f1/32.png) [@geneeyuss](https://www.ruby-forum.com/u/geneeyuss)\
**Post date:** [December 2, 2008, 7:15pm UTC](https://www.ruby-forum.com/t/rails-database-connection/154660/8 "2008-12-02T19:15:51Z")

</div>

Frederick C. wrote:

> On 2 Dec 2008, at 18:04, Srilatha Bhuvanapalli wrote:
> 
> > > > srilatha-bhuvanapallis-macbook-pro:contacts Latha$ rails -v  
> > > > Rails 2.1.2
> > > 
> > > but is that app set to use an old version of rails (eg because it’s  
> > > frozen into vendor/rails or because RAILS\_GEM\_VERSION is set ) ?  
> > > And of course seeing the actual code producing an error always helps.
> > 
> > Could I please how to check if my app to set to old version of rails?
> 
> The easiest way is to run script/console or script/server - they will  
> tell you what version of rails is being used.

Below is what I get when I run script/server:

srilatha-bhuvanapallis-macbook-pro:MyProject Latha$ ruby ./script/server  
./script/…/config/boot.rb:20:Warning: Gem::SourceIndex#search support  
for String patterns is deprecated  
=\> Booting Mongrel (use ‘script/server webrick’ to force WEBrick)  
=\> Rails application starting on [http://0.0.0.0:3000](http://0.0.0.0:3000)  
=\> Call with -d to detach  
=\> Ctrl-C to shutdown server  
\*\* Starting Mongrel listening at 0.0.0.0:3000  
\*\* Starting Rails with development environment…  
\*\* Rails loaded.  
\*\* Loading any Rails specific GemPlugins  
\*\* Signals ready. TERM =\> stop. USR2 =\> restart. INT =\> stop (no  
restart).  
\*\* Rails signals registered. HUP =\> reload (without restart). It might  
not work well.  
\*\* Mongrel 1.1.5 available at 0.0.0.0:3000  
\*\* Use CTRL-C to stop.

Where does it show me the rails version here, Sorry to bother you too  
much. I am new to rails. Kindly bear with me.

Thanks  
Latha

---

<div class="post-metadata">

**Author:** ![geneeyuss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e495f1/32.png) [@geneeyuss](https://www.ruby-forum.com/u/geneeyuss)\
**Post date:** [December 2, 2008, 8:10pm UTC](https://www.ruby-forum.com/t/rails-database-connection/154660/9 "2008-12-02T20:10:55Z")

</div>

Frederick C. wrote:

> On 2 Dec 2008, at 18:15, Srilatha Bhuvanapalli wrote:
> 
> > > > > helps.
> > > > 
> > > > Could I please how to check if my app to set to old version of  
> > > > rails?
> > > 
> > > The easiest way is to run script/console or script/server - they will  
> > > tell you what version of rails is being used.
> > 
> > Below is what I get when I run script/server:
> 
> It doesn’t - newer versions would tell you which already tells you  
> that you’re probably not running 2.1.2.  
> ruby script/console might still tell you (I can’t remember when they  
> started showing versions)
> 
> And like I said before check if your environment.rb sets  
> RAILS\_GEM\_VERSION or if vendor/rails is present.
> 
> Fred

hey,

thanks a lot. that helped me. my applications RAILS\_GEMS\_VERSION was set  
to 1.2.6. I made the change to 2.1.2 and it worked.

Thanks a lot  
Latha
