Skip to content

Instantly share code, notes, and snippets.

View arika's full-sized avatar
🍡 ☕️ 🍰 ☕️ ☕️ ☕️ ☕️

akira yamada arika

🍡 ☕️ 🍰 ☕️ ☕️ ☕️ ☕️
View GitHub Profile
@eileencodes
eileencodes / gist:5b0a2fe011dcff6203fe
Last active October 28, 2021 14:21
CollectionProxy `delete_all` and `destroy_all` behavior by dependency AND association type AND strategy

Testing behavior of a CollectionProxy based on :dependent option, delete method used and assocation type (:has_many vs :has_many :through)

:has_many association

class Category < ActiveRecord::Base
	has_many :contacts, through: :categorizations
	has_many :categorizations, dependent: DEPENDENT
end
@postmodern
postmodern / gix_require_benchmark.rb
Created March 10, 2011 05:04
Benchmark each require in your Ruby code.
require 'rubygems'
require 'rbtree'
class Req
attr_accessor :path, :time, :requires, :exception
def initialize(path)
@path = path
@requires = []
@time = 0
end