Invitable doesn't seem to be working after Ruby 3 upgrade
Environment
- Ruby 3.0.4
- Rails 7.0.2.4
- Devise 4.8.1
Current behavior
Currently the code is breaking with this line
devise :invitable
I am receiving this error:
NoMethodError: undefined method `arity' for {:polymorphic=>true, :optional=>true}:Hash
Expected behavior
No errors should show
@buckled0
We had a similar problem. It was also with devise-invitable gem, the problem was resolved by upgrading gem devise-invitable gem.
Probably this was a problem: After upgrade to ruby 3+ I guess this is what is failing within a gem This issue is probably connected to the way how ruby 3+ versions receive required keywords, hashes are no longer correct argument to send to fill required keywords, instead of that, regular hash is considered as an argument when sent, but with splat operator before hash it is recognized as a set of keywords. Ref: https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
Similar to https://github.com/rails/rails/issues/40957#issuecomment-764260973
example:
doesn't work: foo.new(args).call
work: foo.new(**args).call
@velimir1995 thanks! @buckled0 looks like upgrading devise-invitable should fix your issue.