我正在使用squeel
并且我ActiveRecord::QueryMethods::WhereChain
从查询而不是ActiveRecord::AssociationRelation
.
询问:
game.golfers.where{competitors.swing_golfer IS DISTINCT FROM TRUE}
返回的查询AssociationRelation
game.golfers.where{"competitors.swing_golfer IS DISTINCT FROM TRUE"}
注意引号改变了返回类型。
楷模
class Game < ActiveRecord::Base
has_many :competitors
has_many :golfers, through: :competitors
end
class Golfer < ActiveRecord::Base
has_many :competitors
has_many :games, through: :competitors
end
知道这ActiveRecord::QueryMethods::WhereChain
是什么以及如何使用或避免它吗?
- 红宝石 2.0.0
- 轨道 4.0
- squeel 1.1.1