How can I do something like this in range?
User.find(14000..14500)
I need to choose a certain range of Users starting and finishing on specifics ids.
You can use the where
method:
User.where(id: 14000..14500)
The where
method here receives a hash argument in its shortened form, where the value for the id
key is a Range
.
You can do it like this too:
User.find_by_id(14000..14500)
Try this also
User.find((start..end).to_a)
Ex -
User.find((14000..14500).to_a)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With