YAML defaults in Fixtures

Hi everyone.

I’ve noticed that the documentation on YAML defaults in
Fixtureshttp://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html#label-Support+for+YAML+defaults
seems
to be wrong. The syntax shown is not currently supported at least, if
I’m
not completely mistaken:

DEFAULTS: &DEFAULTS
created_on: <%= 3.weeks.ago.to_s(:db) %>
first:
name: Smurf
*DEFAULTS
second:
name: Fraggle
*DEFAULTS

When using that exact snippet, psych throws a parsing error. If one
changes
“*DEFAULTS” to “<<: *DEFAULTS”, it works. Is the described syntax simply
not supported yet? It seems to have been introduced in YAML
1.2http://www.yaml.org/spec/1.2/spec.html#id2761803

Best regards,
Lucas

On Jan 11, 2:28pm, Lucas J. [email protected] wrote:

“*DEFAULTS” to “<<: *DEFAULTS”, it works. Is the described syntax simply
not supported yet? It seems to have been introduced in YAML
1.2http://www.yaml.org/spec/1.2/spec.html#id2761803

What version of psych? I vaguely recall early versions of it rejecting
stuff like that (that syck had previous accepted)

Fred

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