文件名称:ruby创建blog
文件大小:22KB
文件格式:DOC
更新时间:2021-06-14 10:27:56
rubyblog
1.rails new blog --skip-bundle //创建项目
2.cd blog //进入项目根目录
3.subl . //打开项目开发环境
4.Bundle install //安装gem包环境
5.rails generate model post title:string content:text author:string published_at:datetime
6.rake db:migrate //数据迁移
7.Rails console //控制台
2.4.1 :004 > Post
=> Post (call 'Post.connection' to establish a connection)
2.4.1 :005 > Post.all
Post Load (2.2ms) SELECT "posts".* FROM "posts" LIMIT ? [["LIMIT", 11]]
=> #