1.新建rails工程
$ rails new stu
$ cd stu
$ bundle install
$ rails server
2.创建手脚架
$ rails g scaffold Student name:text score:decimal description:text
3. 生成数据库
$ rake db:create
$ rake db:migrate
$ rails server
4. 修改默认首页
打开config/routes.rb,加入:
$ root 'students#index'
$ rails server
5. 添加数据后
6.Gemfile中加入下面代码
gem "therubyracer"
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
gem "twitter-bootstrap-rails"
7.运行bundle install
$ bundle install
8.将Bootstrap加到assets:
$ rails generate bootstrap:install
9.创建布局文件
$ rails g bootstrap:layout
10. 创建视图文件
$ rails g bootstrap:themed Students