我在应用上使用acts_as_favorite_updated
来保存许多不同的模型。但是,当我尝试启用“收藏”其他用户时,我遇到了一个奇怪的错误。 (很高兴详细解释,但基本上由于呼叫冲突而导致路由变化,具体取决于用户模型中acts_as_favorite和acts_as_favorite_user的顺序。)
任何人都可以推荐一个体面的插件,允许我保存/喜欢特定的模型/对象以及其他用户吗?
答案 0 :(得分:0)
答案 1 :(得分:0)
试试这个分叉:https://github.com/beno/acts_as_favorite
在Gemfile
中,添加:gem 'acts_as_favorite', github: 'beno/acts_as_favorite'
它为模型(很可能是用户)提供了支持(a.k.a. follow)另一个模型的方法。
例如,current_user.favor product
单元测试应该使用更清晰:https://github.com/beno/acts_as_favorite/blob/master/spec/acts_as_favorite_spec.rb
或者,acts_as_follower
gem正在积极开发中。
https://github.com/tcocca/acts_as_follower
class Product < ActiveRecord::Base
acts_as_followable
end
class User < ActiveRecord::Base
acts_as_followable
acts_as_follower
end
然后发出user.follow product