Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Fix ArgumentError in Ruby 3 #43

Closed
wants to merge 1 commit into from

Conversation

yosiat
Copy link

@yosiat yosiat commented Jul 15, 2021

ArgumentError: wrong number of arguments (given 2, expected 1)
/Users/yosi/.rvm/gems/ruby-3.0.2/gems/activerecord-6.1.4/lib/active_record/migration.rb:929:in `block in method_missing'
/Users/yosi/.rvm/gems/ruby-3.0.2/gems/activerecord-6.1.4/lib/active_record/migration.rb:897:in `block in say_with_time'
/Users/yosi/.rvm/gems/ruby-3.0.2/gems/activerecord-6.1.4/lib/active_record/migration.rb:897:in `say_with_time'
/Users/yosi/.rvm/gems/ruby-3.0.2/gems/activerecord-6.1.4/lib/active_record/migration.rb:918:in `method_missing'
/Users/yosi/.rvm/gems/ruby-3.0.2/gems/zero_downtime_migrations-0.0.7/lib/zero_downtime_migrations/migration.rb:83:in `method_missing'
/Users/yosi/.rvm/gems/ruby-3.0.2/gems/zero_downtime_migrations-0.0.7/lib/zero_downtime_migrations/migration.rb:83:in `method_missing'
/Users/yosi/code/rails-appdb/schema.rb:27:in `block in <main>'

```
ArgumentError: wrong number of arguments (given 2, expected 1)
/Users/yosi/.rvm/gems/ruby-3.0.2/gems/activerecord-6.1.4/lib/active_record/migration.rb:929:in `block in method_missing'
/Users/yosi/.rvm/gems/ruby-3.0.2/gems/activerecord-6.1.4/lib/active_record/migration.rb:897:in `block in say_with_time'
/Users/yosi/.rvm/gems/ruby-3.0.2/gems/activerecord-6.1.4/lib/active_record/migration.rb:897:in `say_with_time'
/Users/yosi/.rvm/gems/ruby-3.0.2/gems/activerecord-6.1.4/lib/active_record/migration.rb:918:in `method_missing'
/Users/yosi/.rvm/gems/ruby-3.0.2/gems/zero_downtime_migrations-0.0.7/lib/zero_downtime_migrations/migration.rb:83:in `method_missing'
/Users/yosi/.rvm/gems/ruby-3.0.2/gems/zero_downtime_migrations-0.0.7/lib/zero_downtime_migrations/migration.rb:83:in `method_missing'
/Users/yosi/code/rails-appdb/schema.rb:27:in `block in <main>'
```
@lucascaton
Copy link

@shuber could you merge this PR and release a new version, please? Thank you! 🙂

@yosiat
Copy link
Author

yosiat commented Aug 24, 2021

@shuber please if this possible can you please look at this PR?
If there is something I can do from my side to expedite this, feel free to ask :)

@lucascaton
Copy link

@shuber?

@lucascaton
Copy link

Any news on this?

@lucascaton
Copy link

cc/ @sirctseb, @atambo

@yosiat
Copy link
Author

yosiat commented Jul 6, 2022

Looks like the repository is not longer maintained and I have too much noise in my open PRs, so I am closing it.
If anyone - wants to open a PR based on this code - feel free you have my approval here.

Internally, we added an initializer to fix the issue with this content -

::ZeroDowntimeMigrations::Data.module_eval do
  #
  # Monkey patch to handle ruby 3 changes in torque
  #
  # Fixing:
  #
  # ```
  # ArgumentError:
  #   wrong number of arguments (given 2, expected 1)
  # ./config/initializers/002_ruby3_monkey_patches.rb:6:in `initialize'
  # ./vendor/bundle/ruby/3.0.0/bundler/gems/zero_downtime_migrations-1eac38a359e5/lib/zero_downtime_migrations/data.rb:5:in `initialize'
  # ./vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/relation/delegation.rb:118:in `new'
  # ./vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/relation/delegation.rb:118:in `create
  # ```
  #
  def initialize(...)
    ::ZeroDowntimeMigrations::Migration.data = true
    super(...)
  end
end

And we will migrate to a library which is actively maintained.

@shuber Thanks for this amazing library, saved us lots of issues!

@yosiat yosiat closed this Jul 6, 2022
@lucascaton
Copy link

Yeah, ditto: thanks for the library 🙂

Just sharing this in case anyone is looking for an actively maintained library:

https://github.com/ankane/strong_migrations

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants