<commit_before>require 'rails/generators/active_record'
require 'generators/devise/orm_helpers'

module ActiveRecord
  module Generators
    class DeviseGenerator < ActiveRecord::Generators::Base
      argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"

      include Devise::Generators::OrmHelpers
      source_root File.expand_path("../templates", __FILE__)

      def copy_devise_migration
        unless model_exists?
          migration_template "migration.rb", "db/migrate/devise_create_#{table_name}"
        else
          migration_template "migration_existing.rb", "db/migrate/add_devise_to_#{table_name}"
        end
      end<commit_msg>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.<commit_after>require 'rails/generators/active_record'
require 'generators/devise/orm_helpers'

module ActiveRecord
  module Generators
    class DeviseGenerator < ActiveRecord::Generators::Base
      argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"

      include Devise::Generators::OrmHelpers
      source_root File.expand_path("../templates", __FILE__)

      def copy_devise_migration
        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}"
        end
      end
{'fraction_non_alphanumeric': 0.1002460024600246, 'fraction_numerical': 0.014145141451414513, 'mean_word_length': 3.9755351681957185, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7384286', 'n_tokens_mistral': 498, 'n_tokens_neox': 497, 'n_words': 96}