lib/padrino-gen/generators/components/actions.rb in padrino-gen-0.6.1 vs lib/padrino-gen/generators/components/actions.rb in padrino-gen-0.6.2
- old
+ new
@@ -76,22 +76,22 @@
Dir[app_root_path('db/migrate/*.rb')].map do |f|
File.basename(f).match(/^(\d+)/)[0].to_i
end.max.to_i || 0
end
- #For model destroy option
- #removes the initial migration file of model
+ # For model destroy option
+ # removes the initial migration file of model
def remove_model_migration(name)
remove_migration "Create" + name
end
- #For the removal of migration files
+ # For the removal of migration files
# removes the migration file based on the migration name
def remove_migration(name)
migration_path = Dir[app_root_path('db/migrate/*.rb')].select do |f|
File.basename(f).match(/#{name.to_s.underscore}/)
end.first
- remove_file migration_path
+ remove_file migration_path if migration_path && File.exist?(migration_path)
end
# For testing components
# Injects the test class text into the test_config file for setting up the test gen
# insert_test_suite_setup('...CLASS_NAME...')