Based on the implementation of `column_name` I'd add its extended form: `a.reference? ? "#{a.name}_id" : a.name`. What do you think about it?

See also https://github.com/rails/rails/commit/95ccbd847da149b194cbf423e04e3d19a812dce4