I have created a STATES constant in my application-an array of hashes:
STATES = [ {'code' => 'AL', 'name' => 'Alabama'}, {'code' => 'AK', 'name' => 'Alaska'}, {'code' => 'AZ', 'name' => 'Arizona'}, {'code' => 'AR', 'name' => 'Arkansas'}, {'code' => 'CA', 'name' => 'California'}, etc. ]
I'm storing the state code in the database with an object (i.e., event, address, etc.) When I retrieve, say, an Event from the database, I want to use the code 'AZ' to look up the name 'Arizona' and display it.
I don't seem to be able to get my head around how to accomplish this. Maybe it's because it's late and I'm really tired...