From 99d539b9a79bbc1db3d77f40e890636b5addb5a4 Mon Sep 17 00:00:00 2001 From: Sean Hill Date: Sun, 28 Aug 2011 16:29:06 -0500 Subject: [PATCH] Chagned the copy_devise_migration method to properly handle the :revoke behavior using @daf's commit: https://github.com/daf/devise/commit/acf7e9e2ad30ce1c43b3500ab3b328f836b0893c as a guide. --- lib/generators/active_record/devise_generator.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/generators/active_record/devise_generator.rb b/lib/generators/active_record/devise_generator.rb index 424f7f5e..cf96619d 100644 --- a/lib/generators/active_record/devise_generator.rb +++ b/lib/generators/active_record/devise_generator.rb @@ -10,7 +10,9 @@ module ActiveRecord source_root File.expand_path("../templates", __FILE__) def copy_devise_migration - unless model_exists? + exists = model_exists? + exists = !exists if behavior == :revoke + unless exists migration_template "migration.rb", "db/migrate/devise_create_#{table_name}" else migration_template "migration_existing.rb", "db/migrate/add_devise_to_#{table_name}"