Anchor should not be appended when set to nil/false.

Fixes https://github.com/rails/rails/issues/17714.
Seems like it :smile: Thanks!