lowjoel/activerecord-userstamp

View on GitHub
lib/active_record/userstamp/migration_additions.rb

Summary

Maintainability
A
0 mins
Test Coverage
module ActiveRecord::Userstamp::MigrationHelper
  extend ActiveSupport::Concern

  def userstamps(*args)
    config = ActiveRecord::Userstamp.config
    column(config.creator_attribute, :integer, *args)
    column(config.updater_attribute, :integer, *args)
    column(config.deleter_attribute, :integer, *args) if config.deleter_attribute.present?
  end
end

ActiveRecord::ConnectionAdapters::TableDefinition.class_eval do
  include ActiveRecord::Userstamp::MigrationHelper
end