Forum: Ruby on Rails YAML defaults in Fixtures

53212d1cb7802c6db8e3c05989b9869e?d=identicon&s=25 "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
81b61875e41eaa58887543635d556fca?d=identicon&s=25 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

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.