Skip to content

Instantly share code, notes, and snippets.

@ahoward
Created December 10, 2008 08:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahoward/34272 to your computer and use it in GitHub Desktop.
Save ahoward/34272 to your computer and use it in GitHub Desktop.
has_many :buckets, :dependent => :destroy
buckets = instance_method(:buckets)
define_method(:buckets) do |*a|
@buckets ||= buckets.bind(self).call(*a)
@buckets.each{|bucket| bucket.collection = self}
@buckets
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment