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

Fixes https://github.com/rails/rails/issues/17714.
Merge pull request #17715 from tgxworld/fix_nil_anchor

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