# From Db Text to Hash \[Please Need really Help\]

**URL:** <https://www.ruby-forum.com/t/from-db-text-to-hash-please-need-really-help/123011>\
**Category:** Rails\
**Created:** [December 13, 2007, 12:08pm UTC](https://www.ruby-forum.com/t/from-db-text-to-hash-please-need-really-help/123011 "2007-12-13T12:08:59Z")\
**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, 12:08pm UTC](https://www.ruby-forum.com/t/from-db-text-to-hash-please-need-really-help/123011/1 "2007-12-13T12:08:59Z")

</div>

Dear Teacher,

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
