- 新建项目
rails new 项目名
rails new 项目名 -- api
这个是上面两个创建方式区别
https://ruby-china.org/topics/26212
- 导入依赖,需要你要去把Gemfie文件的镜像改成china的这样可以下载的更快
source 'https://gems.ruby-china.com'
下载依赖
bundle install
- 启动项目
rails s #默认启动,不指定端口号 默认是3000
rails s -p 4001 # 指定端口号
- 去网页访问
localhost:3000
- 新建一个controller
rails g controller welcome index