Class: DDD::Associations::OneToManyCollection
Instance Method Summary
collapse
#initialize
Instance Method Details
#<<(another_one) ⇒ Object
4
5
6
7
8
9
|
# File 'lib/ddd-associations/one_to_many_collection.rb', line 4
def <<(another_one)
unless many.include?(another_one)
many << another_one
another_one.send("#{collection_name}=", one)
end
end
|
#delete(another_one) ⇒ Object
11
12
13
14
15
16
|
# File 'lib/ddd-associations/one_to_many_collection.rb', line 11
def delete(another_one)
if many.include?(another_one)
many.delete(another_one)
another_one.send("#{collection_name}=", nil)
end
end
|