lib/fishplate/tasks.rake in fishplate-0.2.0 vs lib/fishplate/tasks.rake in fishplate-0.2.1
- old
+ new
@@ -21,12 +21,12 @@
task "db:setup" => ["fail_if_prod", "db:create", "db:schema:load"]
desc "Generate new migration with name given, e.g. rake generate:migration[CreateUsers]"
namespace :generate do
task :migration, [:name] do |name, args|
- klass = args[:name].camelize
+ klass = args[:name].gsub('-','_').camelize
number = ActiveRecord::Migration.next_migration_number(0)
- file_name = "#{number}_#{args[:name].underscore}.rb"
+ file_name = "#{number}_#{klass.underscore}.rb"
file_path = A9n.root.join("db/migrate", file_name)
content = <<-CONTENT
|class #{klass} < ActiveRecord::Migration[#{ActiveRecord::Migration.current_version}]
| def change
| end