Forum: Ruby on Rails An easy one: Accessing fixture data in 1.0+

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D6ad52affc12fb2b49b0e5a215a8410a?d=identicon&s=25 Matt Torok (Guest)
on 2006-03-22 13:37
(Received via mailing list)
OK, we all know that Rails turned off instantiated fixtures by default
in 1.0. That's not a problem. However, what I'm now wondering is how
to access the raw fixture data out of the YML file (as opposed to the
database.) Mainly, for comparing my database results with my expected
results in a DRY way.

The book says if you have the command "fixtures :foo", that you'll
then have a hash of the YML data in @foo["name_of_fixture_entry"].
With non-instantiated fixtures, this isn't there. So where'd it go? I
tried googling for the answer, but it only came back with information
telling me that instantiated fixtures are now turned off.

--
-Matt Torok
1e90246fc67e699c32e59db89d4ff5c3?d=identicon&s=25 Michael Kaiser (Guest)
on 2006-03-22 13:54
(Received via mailing list)
Hey,

Matt Torok wrote:
> OK, we all know that Rails turned off instantiated fixtures by default
> in 1.0. That's not a problem. However, what I'm now wondering is how
> to access the raw fixture data out of the YML file (as opposed to the
> database.) Mainly, for comparing my database results with my expected
> results in a DRY way.
>
> The book says if you have the command "fixtures :foo", that you'll
> then have a hash of the YML data in @foo["name_of_fixture_entry"].
> With non-instantiated fixtures, this isn't there. So where'd it go?

It should be in foo["name_of_fixture_entry"] (without the @).

Michael
This topic is locked and can not be replied to.