Rails Migration Errors

Here is the error(s) I received after trying to run a migration:

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:

By adding the rails version number in brackets after class name the migration runs perfectly.

class acts_as_follower < ActiveRecord::Migration[5.1]

...More to come.