I have a table named Player
in my Rails app, and on the table, there are seven boolean attributes.
monday: true, tuesday: false, wednesday: true, thursday: false, friday: false, saturday: true, sunday: false
What is the best way to return an array with all the days that are true with ActiveRecord
? I want to return:
["monday", "wednesday", "saturday"]
Any ideas on an efficient way to do this? I am drawing a blank? Player.first.map
?