我如何替换 div-for 或安装 gem 文件以允许它在 Rails 5 中工作?

How do I replace div-for or install gem file to allow it to work in Rails 5?

我正在做教程:https://reinteractive.com/posts/32-ruby-on-rails-3-2-blog-in-15-minutes-step-by-step

并发现我已升级到 Rails 5 并收到一条错误消息,指出 div-for 已被删除。 "says" 我可以执行以下操作,但是:

woo-va-air:myapp woo$ gem 'record_tag_helper', '~> 1.0'
ERROR:  While executing gem ... (Gem::CommandLineError)
    Unknown command record_tag_helper,
woo-va-air:myapp woo$ ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin16]
woo-va-air:myapp woo$ rails --version
/Users/woo/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/app_loader.rb:40: warning: Insecure world writable dir /Users/woo/.rbenv/versions/2.3.1/bin in PATH, mode 040777
Rails 5.0.0

根据我的阅读,gem 'record_tag_helper' 应该安装那个 gem,但它失败了。在线阅读似乎表明它可能已被转移到其他地方。

关于如何安装 gem 或如何重写的任何想法

<%= div_for comment do %>
        <p>
                <strong>
                        Posted <%= time_ago_in_words(comment.created_at) %> ago
                </strong>
                <br/>
...

所以它可以在 Rails 5 中工作?

尝试添加行

gem 'record_tag_helper', '~> 1.0'

Gemfile,你在你的应用程序目录中,然后运行 bundle install

添加

gem 'record_tag_helper', '~> 1.0' 

到您的 Gemfile 和 运行 捆绑安装

然后:

require 'record_tag_helper' 

在 application.rb 文件中