diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2011-12-09 03:15:59 +0100 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2011-12-09 03:33:06 +0100 |
commit | 1d9de9d7585f2c753b629080b1239969aaf8499a (patch) | |
tree | 7a74cdca5cf071eb589640a4d3dddfbe9bf06eb6 /activerecord/lib | |
parent | b164ab75d65fa0c8a93c287835091bc704c226f1 (diff) | |
download | rails-1d9de9d7585f2c753b629080b1239969aaf8499a.tar.gz rails-1d9de9d7585f2c753b629080b1239969aaf8499a.tar.bz2 rails-1d9de9d7585f2c753b629080b1239969aaf8499a.zip |
Run also migrations in subdirectories.
With this commit, ActiveRecord will also look for migrations
in db/migrate subdirectories.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/migration.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 102a523744..f0dca080c0 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -610,10 +610,11 @@ module ActiveRecord migrations_paths.first end - def migrations(paths) + def migrations(paths, subdirectories = true) paths = Array.wrap(paths) - files = Dir[*paths.map { |p| "#{p}/[0-9]*_*.rb" }] + glob = subdirectories ? "**/" : "" + files = Dir[*paths.map { |p| "#{p}/#{glob}[0-9]*_*.rb" }] seen = Hash.new false |