Displaying 1 result from an estimated 1 matches for "simple_event_2".
Did you mean:
simple_event_1
2006 Feb 15
2
Polymorphic joins work one way, but not the other
...rd::Base
has_many :events, :as => :attachable
#tasks tables is nothing special
end
and now a unit test:
#there''s some fixtures above
def test_polymorphics
assert tasks(:simple_task).events << events(:simple_event_1)
assert tasks(:simple_task).events << events(:simple_event_2)
assert events(:simple_event_1).save!
assert tasks(:simple_task).save!
assert_equal 2, tasks(:simple_task).events.size
assert_equal "simple event 1",
tasks(:simple_task).events.find(1).note
assert_equal "simple task", events(:simple_event_1).task.title
end...