Current_user 有许多喜欢的社区。可以通过这个获取最喜欢的社区。
@communities = current_user.get_up_voted(Community)
然后每个社区都有很多这样的话题。
社区 has_many: Community_topics
Community_topic belongs_to: 社区
现在,如何获取属于 current_user 最喜欢的社区的所有主题?
我试过这个
@communities = current_user.get_up_voted(Community)
@community_topics = Community_topics.where(:community_id => @communities).page(params[:page]).order("last_active_at DESC")
但我收到了这个错误:(
NameError (uninitialized constant UsersController::Community_topics):