use File.basename to get the filename minus .yml

This commit is contained in:
Aaron Patterson 2012-01-03 14:54:29 -08:00
parent 508493ca45
commit 00c5342d96
1 changed files with 3 additions and 2 deletions

View File

@ -754,8 +754,9 @@ module ActiveRecord
def fixtures(*fixture_names)
if fixture_names.first == :all
fixture_names = Dir["#{fixture_path}/**/*.{yml}"]
fixture_names.map! { |f| f[(fixture_path.size + 1)..-5] }
fixture_names = Dir["#{fixture_path}/**/*.yml"].map { |f|
File.basename f, '.yml'
}
else
fixture_names = fixture_names.flatten.map { |n| n.to_s }
end