rails tutorial 01
https://railstutorial-china.org/book/
创建演示应用
$ rails new sample_app
Gemfile
source 'https://rubygems.org'
gem 'rails', '5.0.0.1'
gem 'puma', '3.4.0'
gem 'sass-rails', '5.0.6'
gem 'uglifier', '3.0.0'
gem 'coffee-rails', '4.2.1'
gem 'jquery-rails', '4.1.1'
gem 'turbolinks', '5.0.1'
gem 'jbuilder', '2.4.1'
group :development, :test do
gem 'sqlite3', '1.3.11'
gem 'byebug', '9.0.0', platform: :mri
end
group :development do
gem 'web-console', '3.1.1'
gem 'listen', '3.0.8'
gem 'spring', '1.7.2'
gem 'spring-watcher-listen', '2.0.0'
end
group :test do
gem 'rails-controller-testing', '0.1.1'
gem 'minitest-reporters', '1.1.9'
gem 'guard', '2.13.0'
gem 'guard-minitest', '2.4.4'
end
group :production do
gem 'pg', '0.18.4'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
执行 bundle install 命令安装并引入 Gemfile 文件中指定的 gem,而且要指定 --without production 选项,不安装生产环境使用的 gem:
$ bundle install --without production
如果你之前安装了某个 gem(例如 Rails 本身)的其他版本,与 Gemfile 中指定的版本号不同,最好再执行 bundle update 命令更新 gem,确保安装的版本和指定的一致:
$ bundle update
最后,我们要初始化 Git 仓库:
$ git init
$ git add -A
$ git commit -m "Initialize repository"

浙公网安备 33010602011771号