Rails Easy Data Dumping

Posted by Madhan ayyasamy on Mad Han RoR Tips See other posts from Mad Han RoR Tips or by Madhan ayyasamy
Published on 2010-12-06T09:46:00.000-08:00 Indexed on 2010/12/08 6:01 UTC
Read the original article Hit count: 373

Filed under:
Hi Friends,

The following useful snippets,you can find out the easiest way of ruby on rails environment data dumping.

You’ll often need to get data from production to dev or dev to your local or your local to another developer’s local. One plug-in we use over and over is Yaml_db. This nifty little plug-in enables you to dump or load data by issuing a Rake command. The data is persisted in a yaml file located in db/data.yml. This is very portable and easy to read if you need to examine the data.


01rake db:data:dump
02 
03example data found in db/data.yml
04 
05---
06campaigns:
07  columns:
08  - id
09  - client_id
10  - name
11  - created_at
12  - updated_at
13  - token
14  records:
15  - - "1"
16    - "1"
17    - First push
18    - 2008-11-03 18:23:53
19    - 2008-11-03 18:23:53
20    - 3f2523f6a665
21  - - "2"
22    - "2"
23    - First push
24    - 2008-11-03 18:26:57
25    - 2008-11-03 18:26:57
26    - 9ee8bc427d94

© Mad Han RoR Tips or respective owner

Related posts about Ruby On Rails