Class: Auditing::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#create_controller_filesObject



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

def create_controller_files
  template 'audits_controller.rb', 'app/controllers/audits_controller.rb'
end

#create_helper_filesObject



15
16
17
# File 'lib/generators/auditing/install_generator.rb', line 15

def create_helper_files
  template 'audits_helper.rb', 'app/helpers/audits_helper.rb'
end

#create_initializerObject



36
37
38
# File 'lib/generators/auditing/install_generator.rb', line 36

def create_initializer
  template 'auditing.rb', 'config/initializers/auditing.rb'
end

#create_migrationObject



32
33
34
# File 'lib/generators/auditing/install_generator.rb', line 32

def create_migration
  migration_template 'migration.rb', "db/migrate/create_audits.rb"
end

#create_model_filesObject



19
20
21
# File 'lib/generators/auditing/install_generator.rb', line 19

def create_model_files
  template 'audit.rb', 'app/models/audit.rb'
end

#create_routesObject



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

def create_routes
  route "match ':resource/:id/audits' => 'audits#index', :as => 'audits'"
  route "match 'audit/rollback/:id'   => 'audits#rollback', :as => 'audit_rollback'"
end

#create_view_filesObject



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

def create_view_files
  template 'index.html.erb', 'app/views/audits/index.html.erb'
end