attributes_table_for: check if association exists

resolves #2917