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.
我需要在 User 模型中选择第二个条目。
User.second不工作,也不工作User.2or User.two。
User.second
User.2
User.two
我正在尝试设置u为第二个用户条目(u = User.2)
u
u = User.2
以下应该有效:
User.all.second User.offset(1).first # Assuming you are using incremental keys and have users with ID's 1 and 2: User.find(2)