2023年12月16日发(作者:)

目录

新建空白项目 ................................................................................................................................... 2

错误索引........................................................................................................................................... 7

新建空白项目

1. Dowload Ruby 1.9.2, then setup; For example installed path is C:Ruby192

2. Install rails: run “gem install rails -r” in command line;

then wait minute when ruby to download the rails, after download it will install autoly:

3. Install MySQL, using the default setting;(如果用默认的sqlite的话就可以跳过这个步骤)

When you reach the final panel of the installer, clicking the Finish button will

bring up the configuration wizard.(这里是说安装完成后,点finish,会进入mysql的配置界面)

In the configuration wizard, you can also just accept all of the defaults, except that

in the security panel you must uncheck the "Modify Security Settings"

checkbox(是指配置mysql除了上图中,要去掉Modify Security Settings前的对勾外,其他都用默认);

4. Install a raphical interface DBMS for mysql database;(安装自己喜欢的图形化数据库管理工具);

5. 创建web应用

a) Rails new cookbook(笔者用F:testrail做为rail项目的保存路径)

下表摘自/blog/819762:

文件/文件夹 说明

Gemfile

README

Rakefile

该文件允许你指定你程序所需要的gem (比如你用到了mysql数据库,

你需要在这里指定 gem "mysql").

你的应用程序大体说明. 用这个来告诉他人该程序是干什么的, 等等.

该文件包含了一系列可以在终端运行的命令.

app/

config/

db/

doc/

lib/

log/

public/

script/

test/

tmp/

vendor/

包含了应用程序的控制器,模型,以及视图. 在本教程中你将专注于该文件夹.

配置你应用程序的运行时规格,路由,数据库等等.

基于服务器的Rack配置,用于启动程序.

显示你当前数据库的模式,以及数据库迁移.

你应用的详细文档.

你应用的扩展模块.

日志.

唯一可以被访问的文件夹. 你可以保存你的图像,javascript, 样式表(CSS), 以及其他静态文本.

包含启动你程序的rails脚本,并可以放置其他你用来部署或者运行你程序的脚本.

单元测试,夹具以及其他测试

临时文件

放置第三方代码的地方. 在一个典型的rails应用中, 这将包括ruby

gems, rails源代码 (如果你拷贝到你的应用中的话), 以及包含额外功能的插件.

如果是用的sqlite则不用修改配置文件,如果用的是mysql,需要修改config/文件(以下摘自

/blog/static/116097190/):

1.

rails在config/里修改原来的开发环境配置参数:

development:

adapter: mysql

database: yugioh_dev

encoding: utf8

username: root

password:

host: localhost

*注意冒号后有一个空格

*修改yml文件需重启app后生效

2.该步骤是为了web页和phpadmin里都正确显示中文

mysql新建数据库时,create database后接上character set:

create database yugioh_dev character set utf8;

或者在迁移任务建表时设置charset:

create_table :ranks, :options => 'default charset=utf8' do |t|

#..

end

b) bundle install

c) 启动服务:rails s

(新的script命令变化很大, 现在只需要输入 rails [option] [args] 就可以了,

摘自/blog/819762)

这里可能会遇到错误提示,“找不到”,可以去网上下一个:

放到ruby安装目录的bin下;下载地址/

下载其中的sqlite-dll-win32-x86-*.zip,如下图所示;这里要说明下,希望大家到上面的官方网站下载最新版本,否则可能会提示“无法定位程序输入点

sqlite3_backup_finish 于动态链接库 ”的错误;

d) localhost:3000

错误索引

找不到

无法定位程序输入点 sqlite3_backup_finish 于动态链接库