Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 8ef2463807
Fetching contributors…

Cannot retrieve contributors at this time

30 lines (26 sloc) 0.628 kB
module ActiveRecord::Associations::Builder
class HasAndBelongsToMany < CollectionAssociation #:nodoc:
def macro
:has_and_belongs_to_many
end
def valid_options
super + [:join_table, :association_foreign_key]
end
def build
reflection = super
define_destroy_hook
reflection
end
def define_destroy_hook
name = self.name
model.send(:include, Module.new {
class_eval <<-RUBY, __FILE__, __LINE__ + 1
def destroy_associations
association(:#{name}).delete_all
super
end
RUBY
})
end
end
end
Jump to Line
Something went wrong with that request. Please try again.