Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add a ruby version constraint to gemfile #973

Open
mhenrixon opened this issue Oct 18, 2022 · 0 comments
Open

Please add a ruby version constraint to gemfile #973

mhenrixon opened this issue Oct 18, 2022 · 0 comments

Comments

@mhenrixon
Copy link

On ruby 2.3.8, I get the following error when trying to annotate (latest version):

NoMethodError: undefined method match?' for /^(true|t|yes|y|1)$/i:Regexp Did you mean? match /usr/local/bundle/gems/annotate-3.1.0/lib/annotate/helpers.rb:18:in true?'

Commands

bin/rake annotate_models

Version

  • annotate 3.1.0
  • rails 4.1.16
  • ruby 2.3.8

The fix

I simply added the following monkey patch in an initializer:

if Rails.env.development?
  require 'annotate'

  class Annotate::Helpers
    class << self
      def true?(val)
        val.present? && val =~ Annotate::Constants::TRUE_RE
      end
    end
  end
end

Seems unnecessary to have to

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

No branches or pull requests

1 participant