我想在某个庄园内找到某个类别的企业
我有以下型号
Business has many Categories through Categorizations
Category has many Businesses through Categorizations
Business has many Estates through Localizations
Estate has many Businesses through Localizations
在类别显示操作中,我有
def show
@category = Category.find(params[:id])
@estate = Estate.find(current_user.estate_id)
@businesses = @estate.businesses
end
明显的问题是,无论它属于哪个类别,它都会退回所有企业的遗产。我试图添加一个 .where("category_id = ?", @category_id) 但我得到 column does not exist 错误