注解宝石 Ruby on Rails 5

3

我在使用annotate gem时遇到了一些问题。我的ruby版本是2.3,rails版本是5beta3。bundle install看起来没什么问题,但当我尝试调用annotate命令时,出现了以下错误...

ruby@echobase:~/crash$ annotate
WARN: Unresolved specs during Gem::Specification.reset:
      activerecord (< 6.0, >= 3.2)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/usr/local/lib/ruby/gems/2.3.0/gems/annotate-2.7.0/lib/annotate.rb:12:in `require': cannot load such file -- active_support/core_ext/hash/indifferent_
access (LoadError)
        from /usr/local/lib/ruby/gems/2.3.0/gems/annotate-2.7.0/lib/annotate.rb:12:in `rescue in <top (required)>'
        from /usr/local/lib/ruby/gems/2.3.0/gems/annotate-2.7.0/lib/annotate.rb:6:in `<top (required)>'
        from /usr/local/lib/ruby/gems/2.3.0/gems/annotate-2.7.0/bin/annotate:18:in `require'
        from /usr/local/lib/ruby/gems/2.3.0/gems/annotate-2.7.0/bin/annotate:18:in `<top (required)>'
        from /usr/local/bin/annotate:22:in `load'
        from /usr/local/bin/annotate:22:in `<main>'

不确定发生了什么。

1个回答

3
如果你想在终端中运行这个 gem 包,那么请尝试bundle exec annotate User来使用你的捆绑 gem 包而不是系统 gem 包。你需要在annotate之后提供模型信息。

有时候,当直接使用annotate命令失败时,可以尝试使用rake db:migrate命令来解决问题。 对于Rails 5及更高版本,你可能需要从GitHub上使用devel分支: https://www.bountysource.com/issues/41011908-rake-12-0-0-support - sventechie

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接