Can't launch with latest Rails version
sowenjub opened this issue · 5 comments
sowenjub commented
Hey Jesse, I tried running LazyMigration.run
with rails 6.0.3.2
and I hit this error:
ArgumentError: wrong number of arguments
from ~.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.2/lib/active_record/migration.rb:1028:in `initialize'
I assume it comes from this line:
And is a consequence of this change rails/rails@7cc27d7#diff-8d3c44120f7b67ff79e2fbe6a40d0ad6R1018
gmhawash commented
Same issue with Rails6
jesseduffield commented
Interesting, I'll take a look
PikachuEXE commented
Any update ? ;)
PikachuEXE commented
I got this monkey patch
LazyMigrate::NewMigratorAdapter.class_eval do
def initialize
# TODO: consider making this a method rather than an instance variable
# considering how cheap it is to obtain
@context = ActiveRecord::MigrationContext.new(Rails.root.join('db', 'migrate'), ActiveRecord::SchemaMigration)
end
end
Tested on rails 6.0.3.4
Full initializer content for lazy_migrate
:
# frozen_string_literal: true
require "sane_patch"
require "lazy_migrate"
SanePatch.patch("lazy_migrate", "0.2.0") do
LazyMigrate::NewMigratorAdapter.class_eval do
def initialize
# TODO: consider making this a method rather than an instance variable
# considering how cheap it is to obtain
@context = ActiveRecord::MigrationContext.new(Rails.root.join('db', 'migrate'), ActiveRecord::SchemaMigration)
end
end
end
PikachuEXE commented
Maybe we should consider #3 sooner since rails 6.1 is on RC already?