Module: ZeroDowntime::Deprecatable::ClassMethods

Defined in:
lib/zero_downtime/deprecatable.rb

Instance Method Summary collapse

Instance Method Details

#columns_with_deprecationsObject



38
39
40
41
42
43
# File 'lib/zero_downtime/deprecatable.rb', line 38

def columns_with_deprecations
  all_columns = columns_without_deprecations
  return all_columns unless deprecated_columns

  all_columns.reject { |c| deprecated_columns.include?(c.name) }
end

#deprecate_column(column_name, options = {}) ⇒ Object

deprecate a given column so it will be ignore by activerecord we can remove it once the deprecation is deployed



29
30
31
32
33
34
35
36
# File 'lib/zero_downtime/deprecatable.rb', line 29

def deprecate_column(column_name, options={})
  deprecate_column_reader(column_name, options)
  deprecate_column_writer(column_name)
  override_attribute_methods

  self.deprecated_columns ||= []
  deprecated_columns << column_name.to_s
end