Strange behaviour of `has_many through` associations

class Member < ActiveRecord::Base
has_many :contact_references
has_many :contacts, through: :contact_references # contacts are of
class
Member
end

m1 = Member.new
m2 = Member.new

m1.contacts.include? m2 # => false
m1.contacts << m2
m1.contacts.delete m2
m1.contacts # => []
m1.contacts.include? m2 # => true

W00t?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs