Monday, April 7, 2014

Add field to all the tables using migration

def change
    ActiveRecord::Base.descendants.each do|_model|
      add_column _model.table_name.to_sym, :lock_version, :integer, :default => 0 unless [Model name for which don't want to add the field].include? _model.name
    end
  end