x.指定端口启动rails项目
ruby script/server webrick -p 3000
------------------------------------------------- 0.创建一个项目 rials demoshop ------------------------------------------------- 1.用脚手架创建产品(控制 模型 显示 数据) script/generate scaffold product title:string description:text image_url:string
------------------------------------------------- 2.如果创建错了销毁这些(destroy 销毁 scaffold 脚手架 pronduct产品对象) script/destroy scaffold pronduct
------------------------------------------------- 3.来创建一个sqlite的表(必须有上一步到创建) rake db:migrate ------------------------------------------------- 4.用sqlite命令来查看当前项目migrate当前版本 sqlite3 db/development.sqlite3 "select version from schema_migrations" ------------------------------------------------- 5.查看路由情况 rake routes ------------------------------------------------- 6.数据库迁移增加一个字段脚手架 script/generate migration add_price_to_product price:decimal 然后执行3的步骤 ------------------------------------------------- 7.调试 script/console
------------------------------------------------- 8.只创建一个controller的一个action ruby script/generate controller store index