diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2014-10-12 11:08:50 +0900 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2014-11-02 23:58:30 +0000 |
commit | 1b958e0a79ea92bdcc33f1c2e2882f9a3aac154c (patch) | |
tree | 77b260d9941ebaa8c343b6bf6109c63e5bdfbcf5 | |
parent | 999a07e3b992154e511135096c137c8666ae36b0 (diff) | |
download | rails-1b958e0a79ea92bdcc33f1c2e2882f9a3aac154c.tar.gz rails-1b958e0a79ea92bdcc33f1c2e2882f9a3aac154c.tar.bz2 rails-1b958e0a79ea92bdcc33f1c2e2882f9a3aac154c.zip |
Revert "Replace String index juggling with Pathname goodness in db:fixtures:load"
This reverts commit 482fdad5ef8a73688b50bba3991dd4ef6f286edd.
Fixes #17237.
-rw-r--r-- | activerecord/lib/active_record/railties/databases.rake | 2 | ||||
-rw-r--r-- | railties/test/application/rake/dbs_test.rb | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index 44765bd050..9130649e8d 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -196,7 +196,7 @@ db_namespace = namespace :db do fixture_files = if ENV['FIXTURES'] ENV['FIXTURES'].split(',') else - Pathname.glob("#{fixtures_dir}/**/*.yml").map {|f| f.basename.sub_ext('').to_s } + Dir["#{fixtures_dir}/**/*.yml"].map {|f| f[(fixtures_dir.size + 1)..-5] } end ActiveRecord::FixtureSet.create_fixtures(fixtures_dir, fixture_files) diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb index 267469b6f5..524c70aad2 100644 --- a/railties/test/application/rake/dbs_test.rb +++ b/railties/test/application/rake/dbs_test.rb @@ -109,6 +109,16 @@ module ApplicationTests db_fixtures_load database_url_db_name end + test 'db:fixtures:load with namespaced fixture' do + require "#{app_path}/config/environment" + Dir.chdir(app_path) do + `rails generate model admin::book title:string; + bundle exec rake db:migrate db:fixtures:load` + require "#{app_path}/app/models/admin/book" + assert_equal 2, Admin::Book.count + end + end + def db_structure_dump_and_load(expected_database) Dir.chdir(app_path) do `rails generate model book title:string; |