aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-01-03 14:54:29 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-01-03 14:54:29 -0800
commit00c5342d96a3677c0a6a2bb8316c76182f5bdfdd (patch)
tree95dfe560439706996b7fa41f0104f0d9f19a69c3
parent508493ca458f32517d34369cd93abc6592b29b83 (diff)
downloadrails-00c5342d96a3677c0a6a2bb8316c76182f5bdfdd.tar.gz
rails-00c5342d96a3677c0a6a2bb8316c76182f5bdfdd.tar.bz2
rails-00c5342d96a3677c0a6a2bb8316c76182f5bdfdd.zip
use File.basename to get the filename minus .yml
-rw-r--r--activerecord/lib/active_record/fixtures.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb
index 860e7ea0e4..c85d54f28b 100644
--- a/activerecord/lib/active_record/fixtures.rb
+++ b/activerecord/lib/active_record/fixtures.rb
@@ -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