# # Takes a lookup table with an id/label, and will make the id available via a symbol-ized label. # # tableobject: The table object name (e.g. table name is 'account_statuses'; table object is AccountStatus) # # Usage: # @statuses = lookup_table AccountStatus # # If: # :id => 1, :label => 'Registered' # :id => 2, :label => 'Recurring' # :id => 3, :label => 'Closed' # # Then: # @statuses[:registered] => 1 # @statuses[:recurring] => 2 # @statuses[:closed] => 3 # collection = {} tableobject do | entry | collection({ # Convert the string to be more symbol-like entry(' ')('') => entry }) end return collection end

