Basically, I want an array of ids from the database.
Some background:
I assumed that getting an array of ids would be much more efficient than querying the database for each instance of foo when rendering the foo list with checkboxes.
Ideas? Apologies in advance if this is not clear.
we can use the map method also this way
Model.all.map(&:field_name)
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