# How do I convert string/text from column to hash?

**URL:** <https://www.ruby-forum.com/t/how-do-i-convert-string-text-from-column-to-hash/196542>\
**Category:** Ruby\
**Created:** [December 13, 2007, 5:38pm UTC](https://www.ruby-forum.com/t/how-do-i-convert-string-text-from-column-to-hash/196542 "2007-12-13T17:38:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![malioboro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/eb8c5e/32.png) [@malioboro](https://www.ruby-forum.com/u/malioboro)\
**Post date:** [December 13, 2007, 5:38pm UTC](https://www.ruby-forum.com/t/how-do-i-convert-string-text-from-column-to-hash/196542/1 "2007-12-13T17:38:23Z")

</div>

Hello All…

I am newb in RoR, i have problem to convert data from database to hash.  
Example:

- before I save data to MySQL DB to column ‘budget\_list’, the hash is :  
@market\_budget = [[BMW5, 2007-12-26, 30000], [BMW3, 2007-12-31,  
150000], [HONDA1, 2007-12-19, 10000], [HONDA2, 2007-12-31, 10000],  
[JAGUAR5, 2007-12-28, 50000], [JAGUAR11, 2007-12-18, 70000]]

- Data after stored in column ‘budget\_list’ with text type data in MySQL  
DB:

* * *

- 
  - 101
  - BMW5
  - 2007-12-26
  - 30000

- 
  - 102
  - BMW3
  - 2007-12-31
  - 150000

- 
  - 22
  - HONDA1
  - 2007-12-19
  - 10000

- 
  - 23
  - HONDA2
  - 2007-12-31
  - 10000

- 
  - 26
  - JAGUAR5
  - 2007-12-28
  - 50000

- 
  - 27
  - JAGUAR11
  - 2007-12-18
  - 70000

Now i want call data from column ‘budget\_list’ to be like hash again,  
before hash stored to db. How I can make data budget\_list to be :

@market\_budget = [[BMW5, 2007-12-26, 30000], [BMW3, 2007-12-31,  
150000], [HONDA1, 2007-12-19, 10000], [HONDA2, 2007-12-31, 10000],  
[JAGUAR5, 2007-12-28, 50000], [JAGUAR11, 2007-12-18, 70000]]

Please help me, thank you very much.

FX
