lib/automigration/migrator.rb in automigration-1.0.0 vs lib/automigration/migrator.rb in automigration-1.0.1
- old
+ new
@@ -22,10 +22,11 @@
def initialize(options = {})
options.assert_valid_keys(:skip_output, :models)
@@model_paths.each do |path|
Dir[File.expand_path("**/*.rb", path)].each do |file|
- require file
+ name = file.sub(path.to_s + '/', '').sub(Regexp.new(File.extname(file) + '$'), '')
+ ActiveSupport::Dependencies.constantize(name.classify)
end
end
@models = options[:models] || ActiveRecord::Base.descendants
@options = options