Class: AuthAssistant::Generators::SetupGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
AuthAssist::MigrationHelper, AuthAssist::RoleMigrations
Defined in:
lib/generators/active_record/setup/setup_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



22
23
24
# File 'lib/generators/active_record/setup/setup_generator.rb', line 22

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

Instance Method Details

#run_migrationObject



26
27
28
29
30
31
32
33
# File 'lib/generators/active_record/setup/setup_generator.rb', line 26

def run_migration
  clear_relations :user        
  return nil if !options[:migration]                 
  clazz = AuthAssist::RoleMigrations.clazz(name)
  mig_obj = clazz.new(self)
  mig_obj.run_migration if mig_obj.respond_to? :run_migration
  mig_obj.configure if mig_obj.respond_to? :configure
end