diff --git a/lib/tasks/standalone_migrations.rb b/lib/tasks/standalone_migrations.rb index ab85869..74af7c2 100644 --- a/lib/tasks/standalone_migrations.rb +++ b/lib/tasks/standalone_migrations.rb @@ -65,20 +65,12 @@ desc "Create a new migration" task :new_migration do |t| - unless ENV['name'] + unless migration = ENV['name'] puts "Error: must provide name of migration to generate." puts "For example: rake #{t.name} name=add_field_to_form" exit 1 end - underscore = lambda{|camel_cased_word| - camel_cased_word.to_s.gsub(/::/, '/'). - gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). - gsub(/([a-z\d])([A-Z])/,'\1_\2'). - tr("-", "_"). - downcase - } - class_name = migration.split('_').map{|s| s.capitalize }.join file_contents = <