In case you want to test your gem / plugin on multiple rails version:
ActiveRecord slow_delete_all
Deletes taking to long, just take a break 🙂
(so replication can catch up/things get unblocked)
Only use save sql, there is no escapeing.
class ActiveRecord::Base
def self.slow_delete_all(condition)
count = 0
loop do
result = ActiveRecord::Base.connection.send(:delete_sql, "delete from #{table_name} where #{condition} limit 10000")
count += result
break if result == 0
sleep 1
end
count
end
end
Ruby: Kill all threads
In case you spam a lot of threads and dont know how to get rid of them…
Thread.list.each do |thread| thread.exit unless thread == Thread.current end
assert_change and assert_no_change for Test::Unit + Minitest inspired by RSpec
Usage
Code
Solved: constant “Firefox” is an application which was downloaded from the internet….
Firefox always complains that its downloaded from the internet because the quarantine setting somehow got stuck…
Open the Terminal (e.g. Command+Space and type Terminal)
sudo xattr -d com.apple.quarantine /Applications/Firefox