Check this plugin out:
http://nubyonrails.com/articles/2005/12/27/dump-or-slurp-yaml-
reference-data
Careful when you use it; it overwrites your text fixtures.
You might want to just use part of the plugin''s code to only do the
to yaml bit instead. Have a look here:
http://topfunky.net/svn/plugins/ar_fixtures/lib/ar_fixtures.rb
-christos
On 2 Feb 2007, at 12:48, Giant Cranes wrote:
>
> Hi,
>
> I have a number of .yml fixtures containing data that is loaded
> into my
> db as a migration. Some of this data needs to be cleaned up, so I am
> using the admin part of my rail app to do this editing.
>
> I am now hoping to export the edited data back into yaml, so that I
> can
> update my fixture data and drop and recreate the db as I need.
>
> When I do something like:
>
> Colour.find(:all).to_yaml
>
> I get output like:
>
> - !ruby/object:Colour
> attributes:
> name: Black
> id: "1"
> - !ruby/object:Colour
> attributes:
> name: Blue
> id: "2"
>
> I am hoping to formal the yaml in the same way as the fixtures:
>
> black:
> id: 1
> name: ''Black''
> blue:
> id: 2
> name: ''Blue''
>
>
> Is this possible or do I have to format the output myself?
>
> Thanks,
> GiantCranes
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---