Class: AuthAssist::Generators::ClearGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
MigrationHelper
Defined in:
lib/generators/auth_assist/clear/clear_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MigrationHelper

#copy_migration, #file_reverse, #find_migration, included, #migration, #migration_dir, #migration_exists?, #reverse_migration, #reverse_migration_methods

Methods included from MigrationHelper::CodeRefactor

#clear_user_relations, #erase_in_user, #has_role_assignments, #has_roles, #has_roles_through_assignments, #insert_user_relation, #remove_user_relation, #role_assignment_file_content, #role_file_content, #write_model_file

Class Method Details

.source_rootObject



15
16
17
# File 'lib/generators/auth_assist/clear/clear_generator.rb', line 15

def self.source_root
  @source_root ||= File.expand_path("../../templates", __FILE__)
end

Instance Method Details

#generate_clear_migrationObject



19
20
21
22
23
24
25
# File 'lib/generators/auth_assist/clear/clear_generator.rb', line 19

def generate_clear_migration 
  return nil if !options[:migration]        
  clazz = AuthAssist::RoleMigrations.clazz(name)
  obj = clazz.new(self)
  obj.generate_reverse_migration
  obj.reverse_configure if obj.respond_to? :reverse_configure
end