Commit 8b6e90da by ivan Lan

Fix migrations genterator

parent f2b65e01
......@@ -17,16 +17,16 @@
# Use sort() to order the migrations by seq
# Use [2..-1] to delete the seq
Dir[ File.join(self.class.source_root, '*.rb') ].sort.each { |f|
copy_migration File.basename(f, '.rb')[2..-1]
copy_migration File.basename(f, '.rb')
}
end
protected
def copy_migration(filename)
if self.class.migration_exists?("db/migrate", "#{filename}")
say_status("skipped", "Migration #{filename} already exists")
if self.class.migration_exists?("db/migrate", "#{filename[2..-1]}")
say_status("skipped", "Migration #{filename[2..-1]} already exists")
else
migration_template "#{filename}.rb", "db/migrate/#{filename}.rb"
migration_template "#{filename}.rb", "db/migrate/#{filename[2..-1]}.rb"
end
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment