Class: Rbacan::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/rbacan/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



11
12
13
14
# File 'lib/generators/rbacan/install_generator.rb', line 11

def self.next_migration_number(path)
  next_migration_number = current_migration_number(path) + 1
  ActiveRecord::Migration.next_migration_number(next_migration_number)
end

Instance Method Details

#copy_initializerObject



27
28
29
# File 'lib/generators/rbacan/install_generator.rb', line 27

def copy_initializer
  copy_file 'rbacan.rb', 'config/initializers/rbacan.rb'
end

#copy_migrationsObject



16
17
18
19
20
21
# File 'lib/generators/rbacan/install_generator.rb', line 16

def copy_migrations
  migration_template "create_permissions.rb", "db/migrate/create_permissions.rb"
  migration_template "create_roles.rb", "db/migrate/create_roles.rb"
  migration_template "create_role_permissions.rb", "db/migrate/create_role_permissions.rb"
  migration_template "create_user_roles.rb", "db/migrate/create_user_roles.rb"
end

#copy_seedObject



23
24
25
# File 'lib/generators/rbacan/install_generator.rb', line 23

def copy_seed
  copy_file 'copy_to_seeds.rb', "db/copy_to_seeds.rb"
end