fixes to accept polymorphic relationship #288

Hi @ernie can you take a look and give me feedback, this is to solve #288
cc @MrSnot

PD @fredwu you were right, thanks!