On Jul 25, 11:32 pm, Sergej Andrejev <rails-mailing-l...@andreas-
s.net> wrote:> Hi,
>
> I am very fresh to ruby on rails so maybe I am missing something very
> obvious, but anyway. How do I put serialized data intofixture.
>
> I have a class Board which is somewhat a very complex class. It occupies
> more than one line when converted to yaml. Here is the example of what I
> have been doing and what failed so far.
>
> # Board is false
> one:
> id: 1
> board: |
> <%= Board.new.to_yaml.gsub(/\n/,"\n ")
>
> # Board is false
> one:
> id: 1
> board: |
> <%= Board.new.to_yaml.gsub(/\n/,"\n ").gsub /$/, "
" %>
>
> For now I stick with manual converting but the serialized object is
> about 100 lines and looks plain ugly. So maybe there is a way to put a
> serialized object infixture
> --
> Posted viahttp://www.ruby-forum.com/.
I haven''t tried with yaml, but with xml, I do like this:
one:
id: 1
board: !str ''<%= my_xml %>''
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---