简体   繁体   English

Ruby on Rails项目设置

[英]Ruby on Rails project setup

I am trying to set up a Ruby on Rails project by following the instructions on their website. 我正在尝试按照其网站上的说明设置Ruby on Rails项目。 I am using MySQL database. 我正在使用MySQL数据库。 When I try to create a project using the rails -d mysql demo command. 当我尝试使用rails -d mysql demo命令创建项目时。 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 ? 我不确定基于--database的正确语法是什么?

I am using the instructions on this site , is it something related to version? 我正在使用此网站上的说明, 与版本有关吗? I am using Rails 3.0.3 我正在使用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 对于详细的教程,我建议从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. 如果您希望使用PostgreSQL或sqlite项目,则无需在rails new命令中使用--database标志进行指定。 Check out my answer here to a related issue. 在这里查看我对相关问题的回答。

This is giving some problems. 这带来了一些问题。 The database.yml looks like this: database.yml看起来像这样:
development: 发展:
adapter: mysql 适配器:mysql
database: db/development.sqlite3 数据库:db / development.sqlite3
pool: 5 泳池:5
timeout: 5000 超时:5000
test: 测试:
adapter: mysql 适配器:mysql
database: db/test.sqlite3 数据库:db / test.sqlite3
pool: 5 泳池:5
timeout: 5000 超时:5000

production: 生产:
adapter: mysql 适配器:mysql
database: db/production.sqlite3 数据库:db / production.sqlite3
pool: 5 泳池:5
timeout: 5000 超时:5000

When I changed 'adapter' to mysql, and then try to start server, it still says sqlite.dll not found. 当我将“ adapter”更改为mysql,然后尝试启动服务器时,它仍然显示sqlite.dll未找到。 I guess this is because the project was set up for sqlite3, so just changing the databse.yml is not enough. 我猜这是因为该项目是为sqlite3设置的,因此仅更改databse.yml是不够的。
For learning purposes, it is ok for me to use sqlite db(mysql is not mandatory), but where do I put the dll file? 出于学习目的,我可以使用sqlite db(不是强制性的mysql),但是将dll文件放在哪里?

PS- This is too long for a 'comment', so please bear with me for posting it under Answer. PS-这对于“评论”来说太长了,因此请忍受我将其发布在“答案”下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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