Topic: creating an array from database rows
I am working through the 'Agile Web Development with Rails' book and one of the excercises at the end of the chapter is to replace the drop down list that is hard coded in the chapter as an array with values from a database...
From the chapter we created an array:
PAYMENT_TYPES = [
# Displayed stored in db
[ "Check", "check" ],
[ "Credit Card", "cc" ],
[ "Purchase Order", "po" ]
I have created a new table in the database called payment_types with fields 'display' and 'value' (and of course 'id'). I can't figure out how to get these values into an array like above... I am assuming that is what I need to do...
Can anyone point me in the right direction?