Keybase proof

I hereby claim:

  • I am jondahl on github.
  • I am jondahl ( on keybase.
  • I have a public key ASB5sEzrI01_cIXCStV1CH84V067GeRHa6I2qK_aVCS1UAo

To claim this, I am signing this object:

View has_many :dependent => :restrict
when :restrict
method_name = "has_many_dependent_restrict_for_#{}".to_sym
define_method(method_name) do
unless send(
# change to named error...
raise ActiveRecord::StatementInvalid, "can't delete record because of dependent #{}"
before_destroy method_name
View gist:91930
# Copyright (c) 2009 Jonathan Dahl
# Released under the MIT license. See below for details.
namespace :db do
namespace :data do
desc "Anonymize sensitive information"
task :anonymize => :environment do
View invalid_records.rake
namespace :db do
namespace :data do
desc "Find all invalid ActiveRecord records"
task :invalid_records => :environment do
models = Object.subclasses_of(ActiveRecord::Base)
models.each do |model|
model.all.each do |record|
if !record.valid?
puts "#{model} #{} is invalid: #{record.errors.full_messages.to_sentence}"