Skip to content
Tsutomu Kuroda edited this page Jan 13, 2017 · 11 revisions

Rails 5

Modify Gemfile

gem 'rails', '5.0.1'
$ bundle update
$ bin/rake db:setup
Database 'db/development.sqlite3' already exists
Database 'db/test.sqlite3' already exists
rake aborted!
ActiveRecord::NoEnvironmentInSchemaError: 

Environment data not found in the schema. To resolve this issue, run: 

        bin/rails db:environment:set RAILS_ENV=development


Tasks: TOP => db:schema:load => db:check_protected_environments
(See full trace by running task with --trace)
$ bin/rails db:environment:set RAILS_ENV=development
$ bin/rake db:setup
Database 'db/development.sqlite3' already exists
Database 'db/test.sqlite3' already exists
-- create_table("articles", {:force=>:cascade})
   -> 0.1415s
-- create_table("members", {:force=>:cascade})
   -> 0.1329s
-- initialize_schema_migrations_table()
   -> 0.0004s
-- create_table("articles", {:force=>:cascade})
   -> 0.0722s
-- create_table("members", {:force=>:cascade})
   -> 0.1088s
-- initialize_schema_migrations_table()
   -> 0.0935s
Creating members...
Creating articles...

Remove deprecation warnings

config.serve_static_files is deprecated

$ bin/rails test test/models/member_test.rb
DEPRECATION WARNING: `config.serve_static_files` is deprecated and will be removed in Rails 5.1.
Please use `config.public_file_server.enabled = true` instead.
$ rak serve_static_files
config/environments/test.rb
  16|  config.serve_static_files   = true

config/environments/production.rb
  25|  config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?

config.static_cache_control is deprecated

DEPRECATION WARNING: `config.static_cache_control` is deprecated and will be removed in Rails 5.1.
Please use
`config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }`
instead.
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }

Using a dynamic :action segment in a route is deprecated

DEPRECATION WARNING: Using a dynamic :action segment in a route is deprecated 
and will be removed in Rails 5.1.

Using a dynamic :action segment in a route is deprecated

config/routesr.b

  1.upto(19) do |n|
    get "lesson/step#{n}(/:name)" => "lesson#step#{n}"
  end
Clone this wiki locally