Forum: Ruby on Rails YAML defaults in Fixtures

Posted by "Lucas Jenß" <lucas.jenss@gmail.com> (Guest)
on 2013-01-11 14:55
(Received via mailing list)
Hi everyone.

I've noticed that the documentation on YAML defaults in 
Fixtures<http://api.rubyonrails.org/classes/ActiveRecord/Fi... 
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.2<http://www.yaml.org/spec/1.2/spec.html#id2761803>
 ...

Best regards,
Lucas
Posted by Frederick Cheung (Guest)
on 2013-01-11 14:58
(Received via mailing list)
On Jan 11, 2:28pm, Lucas Jen <lucas.je...@gmail.com> wrote:

> "*DEFAULTS" to "<<: *DEFAULTS", it works. Is the described syntax simply
> not supported yet? It seems to have been introduced in YAML 
1.2<http://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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.