我正在使用活跃的记录信誉系统gem,我想显示一个庄园内某个类别的企业列表以及相关的投票。
所以我有以下模型
Business has many Categories through Categorizations
Category has many Businesses through Categorizations
Business has many Estates through Localizations
Estate has many Businesses through Localizations
在我的商业模式中,我有
has_reputation :votes, source: :user, aggregated_by: :sum
我可以通过相关投票获得业务
@businesses = @estate.businesses.joins(:categories).where(categories: {id: @category.id}).find_with_reputation(:votes, :all, order: "votes desc")
但是我希望这些投票具有特定产权,即当一个企业在遗产中被投票时,那么他在遗产2中的投票数不受影响。
(我认为这可能比最初预期的问题更严重。我是否必须创建另一个代表estates_businesses
的{{1}}的模型?)