9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/generators/radmin/install_generator.rb', line 9
def copy_migrations
mig_dir = 'db/migrate'
Dir[File.join(self.class.source_root,'migrations','*.rb')].sort!.each do |m|
mig_name = File.basename(m).sub(/\.rb$/, '')
new_name = mig_name.gsub(/^[0-9].*?_/, '')
unless self.class.migration_exists?(mig_dir, new_name)
mig_number = ActiveRecord::Generators::Base.next_migration_number(mig_dir)
destination = File.join(mig_dir, "#{mig_number}_#{new_name}.rb")
template("migrations/#{mig_name}.rb", destination)
end
end
end
|