draper
draper copied to clipboard
ArgumentError using helpers with Ruby 3
Hello guys, I upgraded my Ruby for 3.0 from 2.7 and I'm having some troubles.
I have this helper in application_helper.rb:
def format_datetime(date, format: :small)
I18n.l(date, format: format)
rescue I18n::ArgumentError
nil
end
And when I call this method h.format_datetime with format like:
def expire_at(format: :small)
format_datetime(object.expire_at, format: format)
end
I receive:
But it works if I extract to a private method in draper, any thoughts?
Using the current version of Draper from RubyGems results in errors like these. Support for Ruby 3 kwargs was added to git, but has not been released yet. Try installing directly from Github and see if the issue disappears.
# Gemfile
gem 'draper', github: 'drapergem/draper'
@codebycliff is there anything blocking a new minor/patch release for Ruby 3 support?
Using the current version of Draper from RubyGems results in errors like these. Support for Ruby 3 kwargs was added to git, but has not been released yet. Try installing directly from Github and see if the issue disappears.
# Gemfile gem 'draper', github: 'drapergem/draper'
@codebycliff is there anything blocking a new minor/patch release for Ruby 3 support?
Yeah, it works, thanks!
Waiting for the release for ruby 3 support! :)
See https://github.com/drapergem/draper/issues/902
@CaioFML v4.0.2 has been released, so I think we can close this issue. cc @codebycliff