Sha256: c96acd73c5781ef6648e675b76bf7dad7cb046545212306478c6ce761c332b54

Contents?: true

Size: 718 Bytes

Versions: 5

Compression:

Stored size: 718 Bytes

Contents

require 'rails/generators'
require 'rails/generators/migration'
require 'rails/generators/active_record/migration'

module RecordHistory
  class InstallGenerator < Rails::Generators::Base
    include Rails::Generators::Migration
    extend ActiveRecord::Generators::Migration

    source_root File.expand_path('../templates', __FILE__)

    desc 'Generates (but does not run) a migration to add a versions table.'

    def create_migration_file
      %w/create_record_histories alter_record_histories_add_transaction_id/.each do |f|
        begin
          migration_template "#{f}.rb", "db/migrate/#{f}.rb"
        rescue Rails::Generators::Error => e
          puts e.message
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
record_history-0.9.2 lib/generators/record_history/install_generator.rb
record_history-0.9.1 lib/generators/record_history/install_generator.rb
record_history-0.9.0 lib/generators/record_history/install_generator.rb
record_history-0.8.9 lib/generators/record_history/install_generator.rb
record_history-0.8.8 lib/generators/record_history/install_generator.rb