简体   繁体   中英

Ruby on Rails project setup

I am trying to set up a Ruby on Rails project by following the instructions on their website. I am using MySQL database. When I try to create a project using the rails -d mysql demo command. I just get the default usage: instructions. Something like below...

-d, [--database=DATABASE]   # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db)
                            # Default: sqlite3

I am not sure what is the correct syntax based on --database ?

I am using the instructions on this site , is it something related to version? I am using Rails 3.0.3

I suggest doing the following.

$ sudo gem install rails mysql
$ rails demo
$ cd demo
$ edit database.yml
# change database type from sqlite3 to mysql
$ rails server -p 4000
# open a web browser to localhost:4000 and see if you see some, else look at the error log in the terminal

Edit

For a detailed tutorial I suggest This Tutorial from railstutorial.org

If you want to have you project to work with PostgreSQL or sqlite, you'll need t specify it using the --database flag in the rails new command. Check out my answer here to a related issue.

This is giving some problems. The database.yml looks like this:
development:
adapter: mysql
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: mysql
database: db/test.sqlite3
pool: 5
timeout: 5000

production:
adapter: mysql
database: db/production.sqlite3
pool: 5
timeout: 5000

When I changed 'adapter' to mysql, and then try to start server, it still says sqlite.dll not found. I guess this is because the project was set up for sqlite3, so just changing the databse.yml is not enough.
For learning purposes, it is ok for me to use sqlite db(mysql is not mandatory), but where do I put the dll file?

PS- This is too long for a 'comment', so please bear with me for posting it under Answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM