具体的搭建过程详见这个链接:
http://railstutorial-china.org/chapter1.html
下面是我在使用的时候出现的错误以及解决方案:
错误:
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p353@railstutorial_rails_4_0/gems/mysql2-0.3.14 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.0.0-p353@railstutorial_rails_4_0/extensions/x86_64-linux/2.0.0/mysql2-0.3.14/gem_make.out
An error occurred while installing mysql2 (0.3.14), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.14'` succeeds before bundling.
yum install mysql-devel
执行rails server 出现in `autodetect': Could not find a JavaScript runtime.
执行rails server
in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
解决:
在GemFile(文件的位置在项目的首页中) 文件的末尾加上
gem 'execjs'
gem 'therubyracer'
之后执行
bundle install