Fix #1249: support relation by array attributes

Fix #1249: support relation by array attributes
I'm a bit concerned with this change. 

* With this change, the meaning of `getModelKey()` becomes very vague. What does it return indeed?
* This method is also used in several other places, but only one place is handled in this PR.