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 モデルの 2 番目のエントリを選択する必要があります。
User.secondは機能しませUser.2んUser.two。
User.second
User.2
User.two
u2 番目のユーザー エントリに設定しようとしています ( 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)