Class: DoubleEntry::Reporting::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



13
14
15
# File 'lib/generators/double_entry/reporting/install/install_generator.rb', line 13

def self.next_migration_number(path)
  ActiveRecord::Generators::Base.next_migration_number(path)
end

Instance Method Details

#copy_migrationsObject



17
18
19
# File 'lib/generators/double_entry/reporting/install/install_generator.rb', line 17

def copy_migrations
  migration_template 'migration.rb', 'db/migrate/create_double_entry_reporting_tables.rb', migration_version: migration_version
end

#migration_versionObject



21
22
23
24
25
# File 'lib/generators/double_entry/reporting/install/install_generator.rb', line 21

def migration_version
  if ActiveRecord.version.version > '5'
    "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
  end
end