Thursday, May 5, 2011

rails windows problem

Hello,

I just installed ruby on rails on windows.

install mysql and created a new project. Then I changed database.yml to use my own mysql server as follow

development: adapter: mysql database: mytools username: test password: test

when I try to access story controller(http://localhost:3000/stories), error shows

"SQLite3::SQLException: no such table: stories: SELECT * FROM "stories" "

Why am I getting this error? I am not using mysql...

From stackoverflow
  • By default Rails creates and uses a SQLite database not a MySQL one.

    You can specify the database to use with the -d flag when creating your Rails application. For example to create a rails app called "sample" using mysql as the database:

    rails sample -d mysql
    

    Taken from the Getting Started with Rails guide.

    You might also want to check out the section on Configuring a MySQL Database in the same document.

    Moon : how did I miss that?? Thank you!!
  • From what I know - though I was coding in rails long ago, there are 3 separate databases there: development, production and test. Maybe You are trying to use test or production and You didn't configured them?

  • Did you try a restart on the webserver?

    Check if the RAILS_ENV is set to production and if it is, set it for development:

    set RAILS_ENV=development
    

0 comments:

Post a Comment