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

  • Thread starter Fransiscus Xaverius
  • Start date
F

Fransiscus Xaverius

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top