エラー Error
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:
Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for:
class CreateFriendlyIdSlugs < ActiveRecord::Migration[4.2]
/home/ekrem/Projects/ekomerz/db/migrate/20170308164827_create_friendly_id_slugs.rb:1:in `<top (required)>'
/home/ekrem/Projects/ekomerz/bin/rails:9:in `require'
/home/ekrem/Projects/ekomerz/bin/rails:9:in `<top (required)>'
/home/ekrem/Projects/ekomerz/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
StandardError: Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for:
class CreateFriendlyIdSlugs < ActiveRecord::Migration[4.2]
/home/ekrem/Projects/ekomerz/db/migrate/20170308164827_create_friendly_id_slugs.rb:1:in `<top (required)>'
/home/ekrem/Projects/ekomerz/bin/rails:9:in `require'
/home/ekrem/Projects/ekomerz/bin/rails:9:in `<top (required)>'
/home/ekrem/Projects/ekomerz/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
解決策 Soloution
ただ[5.1]
をマイグレーションファイルに追加するだけ
Just add [5.1]
to the code below in the migration file.
前 before
class CreateFriendlyIdSlugs < ActiveRecord::Migration
後 after
class CreateFriendlyIdSlugs < ActiveRecord::Migration[5.1]