Ruby on Rails 学习记录(1)
本人使用APTANA1.2.6作为开发环境进行学习的,Ruby 1.8.6,Rails 2.3.2。
创建一个简单的rails项目并运行的过程如下:
1. 创建一个rails项目depot,打开rails shell
使用命令:rails depot -d mysql , 这里使用mysql数据库
2. 创建脚手架
使用命令:ruby script/generate scaffold product title:string description:text image_url:string
3. 修改并保存database.yml中的数据库密码
4. 确保步骤3已完成,创建数据库
使用命令:rake db:create RAILS_ENV='development'
5. 迁移数据库
使用命令 :rake db:migrate
6. 修改aptana中的servers视图的depot服务器的属性,host的值改为127.0.0.1
7. 启动项目
右键选择aptana中的servers视图的depot,启动服务器
8. 打开浏览器,输入:http://127.0.0.1/products