ctran/annotate_models

Please add a ruby version constraint to gemfile

mhenrixon opened this issue · 0 comments

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