标签:
Part 1
-首先最基本的,创建一个新的的project:
rails new blog-然后修改source为https://ruby.taobao.com,加入bootstrap的gem到Gemfile:
gem ‘twitter-bootstrap-rails‘执行bundle install没有错误,但是有一个提示:
Important: You may need to add a javascript runtime to your Gemfile in order for bootstrap‘s LESS files to compile to CSS. ********************************************** ExecJS supports these runtimes: therubyracer - Google V8 embedded within Ruby therubyrhino - Mozilla Rhino embedded within JRuby Node.js Apple JavaScriptCore - Included with Mac OS X Microsoft Windows Script Host (JScript) **********************************************看提示是缺少了一个js的runtime,Ok,按照提示我安装了ExecJS
gem install execjs
然后在Gemfile里面添加了ExecJS支持的runtime:
gem ‘therubyracer‘再次bundle install,没有问题,访问localhost:3000,可以正常访问!
Part 2
-创建首页
rails generate controller blogs
def index end
然后在views目录下面创建index.html.erb文件,加入一行html的代码
<h1>Hola,Rails!</h1>
最后就是更改routes.rb文件,添加
root to: ‘blogs#index‘
标签:
原文地址:http://my.oschina.net/u/913344/blog/365433