This forum is no longer active. Please post your questions to our new community site

RubyStack & MySQL does not work

Subscribe to RubyStack & MySQL does not work 6 post(s), 2 voice(s)

 
Avatar rice 4 post(s)

I did a fresh installation of rubystack with the sample project. Sample project uses MySQL as a default as its database. I tried to run a quick test to the sample project (create simple scaffold) just to test rails.

While migrating database, rails prints this error:

RuntimeError (!!! Missing the mysql2 gem. Add it to your Gemfile: gem ‘mysql2’):

database.yml says the adapter is mysql.

If I change it to mysql2, error is “can’t convert Fixnum into String”. Sometimes rails tells me to install activerecord-mysql-adapter.

OS is Mac OS X 10.6.6, Rubystack is 2.1.1.

Any ideas? I can setup SQLite, but I would like to test rails with MySQL.

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Hi,

Are you running the command from the “rubyconsole” ? This is to use the Stack binaries instead of your system versions.

$ cd /Applications/rubystack-2.1.1
$ ./rubyconsole
$ rails example

 
Avatar rice 4 post(s)

Hi,

Yes, I am running commands in rubyconsole.

 
Avatar rice 4 post(s)

Another test.

I made new example with

rails new example -d mysql

Generated config/database.yml says that I should install mysql (gem install mysql2). If I run that command in rubyconsole, it gives this error:

ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.

Test continues. I edited database.yml file right (added socket: /Applications…../ etc) and changed the right info for the database. Now the error is

(in /Applications/rubystack-2.1-1/projects/example)
rake aborted!
can’t convert Fixnum into String

 
Avatar rice 4 post(s)

Problem solved. I had test password which was all numbers. Rake couldn’t understand this.

password: 1234 to password: “1234”

:)

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Glad to hear you fixed the problem :)