Use ActiveRecord 4 style association syntax if available
Use connection class method to better support ActiveRecord 4