Class: PaperTrail::InstallGenerator

Inherits:
MigrationGenerator show all
Defined in:
lib/generators/paper_trail/install/install_generator.rb

Overview

Installs PaperTrail in a rails app.

Constant Summary collapse

MYSQL_ADAPTERS =

Class names of MySQL adapters.

  • ‘MysqlAdapter` - Used by gems: `mysql`, `activerecord-jdbcmysql-adapter`.

  • ‘Mysql2Adapter` - Used by `mysql2` gem.

[
  "ActiveRecord::ConnectionAdapters::MysqlAdapter",
  "ActiveRecord::ConnectionAdapters::Mysql2Adapter"
].freeze

Instance Method Summary collapse

Methods inherited from MigrationGenerator

next_migration_number

Instance Method Details

#create_migration_fileObject



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/generators/paper_trail/install/install_generator.rb', line 33

def create_migration_file
  add_paper_trail_migration(
    "create_versions",
    item_type_options: item_type_options,
    versions_table_options: versions_table_options,
    item_id_type_options: item_id_type_options,
    version_table_primary_key_type: version_table_primary_key_type
  )
  if options.with_changes?
    add_paper_trail_migration("add_object_changes_to_versions")
  end
end