Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use File.basename to get the filename minus .yml

  • Loading branch information...
commit 00c5342d96a3677c0a6a2bb8316c76182f5bdfdd 1 parent 508493c
@tenderlove tenderlove authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 activerecord/lib/active_record/fixtures.rb
View
5 activerecord/lib/active_record/fixtures.rb
@@ -754,8 +754,9 @@ def set_fixture_class(class_names = {})
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

2 comments on commit 00c5342

@pixeltrix
Owner

This breaks namespaced fixtures when using fixtures :all as the File.basename strips off any namespace. The tests didn't catch it because they're specified individually. Any objection to just reverting this or would you prefer it written some other way?

@tenderlove
Owner

@pixeltrix nah, I'll just revert it. I suppose we should figure out a test for this. :(

Please sign in to comment.
Something went wrong with that request. Please try again.