Permalink
Browse files

- ActiveResoruce association added method delete to has_many

  association
  • Loading branch information...
1 parent 93cc66a commit 9c3e20f67a410818b24065a4c2c0fa090cf22d98 @gramos committed Oct 1, 2010
@@ -121,6 +121,12 @@ def collection.<<(member)
member.save
end"
+ instance_eval "
+ def collection.delete(member)
+ member.#{o[:association_col]} = nil
+ member.save
+ end"
+
set_resource_instance_variable(resource) do
collection
end
@@ -115,5 +115,10 @@ def test_has_many_accessor_should_return_the_an_array_including_the_added_obj
assert_equal @other_milestone.project_id, @project.id
end
+ def test_has_many_accessor_should_return_the_an_array_without_including_the_deleted_obj
+ @project.milestones << @other_milestone
+ @project.milestones.delete(@other_milestone)
+ assert_nil @other_milestone.project_id
+ end
end

0 comments on commit 9c3e20f

Please sign in to comment.