What's New in Edge Rails: Collection Fixtures

Posted by ryan
at 2:16 PM on Tuesday, June 05, 2007



For those of you tired of referencing the fixture method when building a collection of fixtures, your day has come

Gone are the days of unnecessary typing:

1
2
3
fixtures :states
..
assert_equal [states(:nc), states(:va)], State.find(:all)

and here are the days of a convenient syntax for retrieving more than one fixture at a time:

1
2
3
fixtures :states
..
assert_equal states(:nc, :va), State.find(:all)

Revolutionary? No. Useful? Yes.

tags: ruby, rubyonrails

Comments

Leave a response

  1. MartinJune 05, 2007 @ 03:57 PM

    You who seem to have a lot of knowledge of edge rails. Have you toyed anything with the new activeresources? Ive played a little with it to find out if it would be a cool way to do resource oriented apps instead of service oriented but i cant manage to make nested resources work with the site.self, do you know anything about this? Sorry for changing subject =)

  2. Jon MaddoxJune 06, 2007 @ 10:51 AM

    ok, now thats nice and clean :)