Rank traps ActiveRecord only if defined

[fixes #181]