From 5278af3d8efbe348864baca0c40a532e8b137ce1 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 10 May 2011 10:31:52 -0700 Subject: return an empty array for empty yaml files --- activerecord/lib/active_record/fixtures/file.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/fixtures/file.rb') diff --git a/activerecord/lib/active_record/fixtures/file.rb b/activerecord/lib/active_record/fixtures/file.rb index 9e95007f40..beda5a65df 100644 --- a/activerecord/lib/active_record/fixtures/file.rb +++ b/activerecord/lib/active_record/fixtures/file.rb @@ -32,7 +32,9 @@ module ActiveRecord private def rows return @rows if @rows - @rows = YAML.load(render(IO.read(@file))).to_a + + data = YAML.load(render(IO.read(@file))) + @rows = data ? data.to_a : [] end def render(content) -- cgit v1.2.3