Sha256: d383bf4eee4e1dab9a6d0ba034d6f9dcf1c59a5253459d32cb6a5020a2bb620e
Contents?: true
Size: 945 Bytes
Versions: 9
Compression:
Stored size: 945 Bytes
Contents
# frozen_string_literal: true require "generators/delayed_job/delayed_job_generator" require "generators/delayed_job/next_migration_version" require "rails/generators/migration" require "rails/generators/active_record" # Extend the DelayedJobGenerator so that it creates an AR migration module DelayedJob class ActiveRecordGenerator < ::DelayedJobGenerator include Rails::Generators::Migration extend NextMigrationVersion source_paths << File.join(File.dirname(__FILE__), "templates") def create_migration_file migration_template "migration.rb", "db/migrate/create_delayed_jobs.rb", migration_version: migration_version end def self.next_migration_number(dirname) ActiveRecord::Generators::Base.next_migration_number dirname end private def migration_version "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]" if ActiveRecord::VERSION::MAJOR >= 5 end end end
Version data entries
9 entries across 9 versions & 1 rubygems