draper icon indicating copy to clipboard operation
draper copied to clipboard

ArgumentError using helpers with Ruby 3

Open CaioFML opened this issue 3 years ago • 4 comments

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:

image

But it works if I extract to a private method in draper, any thoughts?

CaioFML avatar Mar 19 '21 20:03 CaioFML

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?

brian-kephart avatar Mar 23 '21 19:03 brian-kephart

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! :)

CaioFML avatar Mar 23 '21 20:03 CaioFML

See https://github.com/drapergem/draper/issues/902

tisba avatar Apr 13 '21 18:04 tisba

@CaioFML v4.0.2 has been released, so I think we can close this issue. cc @codebycliff

mishina2228 avatar Mar 02 '22 12:03 mishina2228