alexpetrov / objects_on_rails_bloog

My version of Bloog application from amazing Objects On Rails book by Avdi Grimm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Heisenbug in TextPostExhibit.applicable_to?(object) method. object.class == Post, but object.is_a?(Post) == false

alexpetrov opened this issue · comments

Description. There is a strange heisenbug in TextPostExhibit.applicable_to?(object) method.
object.class == Post every time, but some times object.is_a?(Post) == false.
It may be because of object is actually is TextPostExhibit, but in Exhibit superclass class method overriden to return Exhibited object's class.
I have to return to this issue some later, but now I have to hurry up studying Objects On Rails techniques.

Here is the log when bug appears:
D, [2013-08-07T22:43:39.110814 #4544] DEBUG -- : Issue #1: Heisenbug debug info: object.class == Post; object.is_a?(Post) == false
D, [2013-08-07T22:43:39.110870 #4544] DEBUG -- : Issue #1: Heisenbug debug info: object.class == Post; object.is_a?(Post) == false

Here is the log when bug not appears:
D, [2013-08-07T22:51:17.117314 #6688] DEBUG -- : Issue #1: Heisenbug debug info: object.class == Post; object.is_a?(Post) == true
D, [2013-08-07T22:51:17.117431 #6688] DEBUG -- : Issue #1: Heisenbug debug info: object.class == Post; object.is_a?(Post) == true

One assumption is that the bug appears after some time.