Rails3 compatibility: Query model