【问题标题】:Undefined method `acts_as_tree'未定义的方法“acts_as_tree”
【发布时间】:2017-06-26 21:45:21
【问题描述】:

我正在将项目从 rails 2 升级到 4,但找不到与 rails 4 的“acts_as_tree”等效的 gem。我看到线程说“acts_as_tree”已被弃用,所以我正在寻找另一种使用此方法的方法在 Rails 4 中。谢谢!

【问题讨论】:

  • acts_as_tree 似乎没有被弃用。
  • 我已经使用“gem installacts_as_tree”安装了,然后捆绑安装。但它仍然给我同样的错误'未定义的方法`acts_as_tree'
  • gem install acts_as_tree and then bundle install. 因为这不是您使用 bundler 安装 gem 的方式...将它添加到您的 Gemfile 然后运行 ​​bundle install。这样做之后,它应该列在Gemfile.lock

标签: ruby-on-rails deprecated acts-as-tree


【解决方案1】:

acts_as_tree 现在是一颗宝石。如果你想使用它 - 将它添加到你的 Gemfile 中

这里是 github 上的 acts_as_tree 项目: https://github.com/amerine/acts_as_tree

【讨论】:

  • 但是为什么错误说Undefined Methodacts_as_tree?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-09-17
  • 2013-06-11
  • 2010-12-30
  • 2019-12-25
  • 2021-07-25
  • 2019-06-20
  • 2014-08-23
相关资源
最近更新 更多