diff --git a/lib/generators/double_entry/install/templates/migration.rb b/lib/generators/double_entry/install/templates/migration.rb
index <HASH>..<HASH> 100644
--- a/lib/generators/double_entry/install/templates/migration.rb
+++ b/lib/generators/double_entry/install/templates/migration.rb
@@ -1,5 +1,10 @@
-class CreateDoubleEntryTables < ActiveRecord::Migration[4.2]
+if Rails::VERSION::STRING[0..2].to_f < 5
+  active_record_migration_class = ActiveRecord::Migration[Rails::VERSION::STRING[0..2].to_f]
+else
+  active_record_migration_class = ActiveRecord::Migration
+end
 
+class CreateDoubleEntryTables < active_record_migration_class
   def self.up
     create_table "double_entry_account_balances", :force => true do |t|
       t.string     "account", :limit => 31, :null => false
gracefully fallback class so rails 4 doesn't break