Check if the given association respond to `order` before calling it.

Fixes #966.

As described in #966, it is possible to pass an object to `f.association` that may not respond to `order`. In order to prevent errors, it now checks if the given object respond to `order` before calling it.