I would like to made a query on a polymorphic association :
@pois = Poi.where(poitable: Sleep.where(track_id: @track.id))
Fine, there works... and I would like add a second argument :
@pois = Poi.where(poitable: Sleep.where(track_id: @track.id)).or.where(poitable: Town.where(track_id: @track.id))
Now, I get an error : "wrong number of arguments (given 0, expected 1)"
What's wrong ?
The or method takes an argument that's another ActiveRecord query
So the syntax would be :
Poi.where(poitable: Sleep.where(track_id: @track.id)).or(Poi.where(poitable: Town.where(track_id: @track.id)))