鑑於以下型號:如何編寫包含第三個模型並進行篩選的rails查詢?
User (id)
has_many :groups
has_many :communities
Groups (community_id (OPTIONAL))
belongs_to :user
belongs_to :community
Communities (id, archived (boolean))
has_many :groups
has_many :group_members, :include => :user
我可以很容易地通過做得到用戶的羣體:
current_user.groups
的問題是,如果一個社會的存檔,我不想說在current_user.groups中返回。
如何獲取社區未歸檔的所有用戶組?
感謝
您如何表示社區已歸檔? – 2012-07-13 20:49:58
Community.archived – AnApprentice 2012-07-13 20:50:26
請張貼該方法。反映檔案數據庫的哪些變化。 – 2012-07-13 20:51:41