Use scope instead of find_by_sql to obtain ActiveRecord::Relation.