class AcidicJobGenerator
This generator adds a migration for the {FriendlyId::History FriendlyId::History} addon.
Public Class Methods
next_migration_number(_path)
click to toggle source
# File lib/generators/acidic_job_generator.rb, line 15 def self.next_migration_number(_path) if instance_variable_defined?("@prev_migration_nr") @prev_migration_nr += 1 else @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i end @prev_migration_nr.to_s end
Public Instance Methods
copy_files()
click to toggle source
Copies the migration template to db/migrate.
# File lib/generators/acidic_job_generator.rb, line 26 def copy_files migration_template "migration.rb.erb", "db/migrate/create_acidic_job_keys.rb" end
Protected Instance Methods
migration_class()
click to toggle source
# File lib/generators/acidic_job_generator.rb, line 33 def migration_class if ActiveRecord::VERSION::MAJOR >= 5 ActiveRecord::Migration["#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}"] else ActiveRecord::Migration end end