aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-05-10 10:31:52 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-05-23 15:06:12 -0700
commit5278af3d8efbe348864baca0c40a532e8b137ce1 (patch)
tree8c81aecb755492b011b461e2dd7fa721c5cd7e34 /activerecord/lib/active_record
parent74c5f65bfb7813cecb3a1e78b522de4586e76ac9 (diff)
downloadrails-5278af3d8efbe348864baca0c40a532e8b137ce1.tar.gz
rails-5278af3d8efbe348864baca0c40a532e8b137ce1.tar.bz2
rails-5278af3d8efbe348864baca0c40a532e8b137ce1.zip
return an empty array for empty yaml files
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/fixtures/file.rb4
1 files changed, 3 insertions, 1 deletions
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)