Sha256: 06449a67bc7ef3c8e58cac79f5a8bb95622ea516e79a3d0926f1e1bebd4b72c1
Contents?: true
Size: 831 Bytes
Versions: 2
Compression:
Stored size: 831 Bytes
Contents
require "deprecated_columns/version" require "deprecated_columns/warn_on_column_removal" module DeprecatedColumns def self.included(base) base.extend ClassMethods end module ClassMethods def deprecated_columns(*names) unless self.respond_to?(:deprecated_column_list) class_attribute :deprecated_column_list self.deprecated_column_list = [] end self.deprecated_column_list += names.map(&:to_s) class_eval do def attribute_names super.reject { |name| deprecated_column_list.include?(name) } end def columns super.reject { |column| deprecated_column_list.include?(column.name) } end end end end end ActiveRecord::Base.send :include, DeprecatedColumns ActiveRecord::Migration.send :prepend, WarnOnColumnRemoval
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
deprecated_columns-0.1.1 | lib/deprecated_columns.rb |
deprecated_columns-0.1.0 | lib/deprecated_columns.rb |