Putting serialized data into fixture

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 into fixture.

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 in fixture

On Jul 25, 11:32 pm, Sergej Andrejev <rails-mailing-l…@andreas-
s.net> wrote:

one:
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 %>’

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs