Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想选择除第一个之外的所有 id。 User.find(:all) 调用所有 id,但我怎样才能例外?
通过单个查询:
User.offset(1).pluck(:id)
会给你除了第一个之外的所有 id
User.where(:_id.ne => User.first.id).map(&:_id)