Groups
Groups
Sign in
Groups
Groups
Ruby on Rails: Talk
Conversations
About
Send feedback
Help
Strange behaviour of `has_many through` associations
13 views
Skip to first unread message
Roman
unread,
Feb 27, 2013, 7:46:00 AM
2/27/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
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?
Reply all
Reply to author
Forward
0 new messages