0
class Game < ActiveRecord::Base
has_many :game_types, :dependent => :destroy
has_many :types, :through => :game_types
end
class Type < ActiveRecord::Base
has_many :game_types, :dependent => :destroy
has_many :games, :through => :game_types
end
遊戲類型1 ==單人 遊戲類型2 ==多人導軌的has_many或查詢
我如何可以查詢有兩種類型ID 1或2或兩個遊戲?
此外,我如何查詢既沒有?
這是通過will_paginate與分頁使用,所以單個查詢將是可取的。
預先感謝您拯救我的理智。
非常好 - 謝謝。 – pglombardo 2012-07-16 15:58:03