Railsアプリケーション作成、実行

railsのアプリケーション作成

rails _5.1.6_ new hello_world


問題

バージョン指定しているのになぜか勝手にバージョンが5.2.1のrailsになっちゃう


解決方法

mkdir hello_world
cd hello_world
bundle init
vim Gemfile

Gemfile

source 'https://rubygems.org'

gem 'rails',        '5.1.6'
gem 'puma',         '3.9.1'
gem 'sass-rails',   '5.0.6'
gem 'uglifier',     '3.2.0'
gem 'coffee-rails', '4.2.2'
gem 'jquery-rails', '4.3.1'
gem 'turbolinks',   '5.0.1'
gem 'jbuilder',     '2.6.4'

group :development, :test do
  gem 'sqlite3',      '1.3.13'
  gem 'byebug', '9.0.6', platform: :mri
end

group :development do
  gem 'web-console',           '3.5.1'
  gem 'listen',                '3.1.5'
  gem 'spring',                '2.0.2'
  gem 'spring-watcher-listen', '2.0.1'
end

# Windows環境ではtzinfo-dataというgemを含める必要があります
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]


bundle install --path vendor/bundle

bundle exec rails new --skip-bundle .



railsアプリケーションの実行

rails server