简体   繁体   中英

Why is Rails not displaying strings that end in a period

If I save this string to an address field:

11060 Westmoor Dr.

It doesn't display in the UI.

But if it saved without the period at the end,

11060 Westmoor Dr

Then is does display in the UI.

Why does the period cause the string not to display?

I'm displaying it like this:

<%= f.label "#{user_event.address1}, ", class: 'info_label' %>

Thanks!

I'm not sure why you're using a label in this manner. The label should be used as a field name. So, rather than output the string of someone's address, you should use it like:

<%= f.label :address_line_1 %>
<%= f.text_field_tag :address_line_1 %>

Rails is removing punctuation here because you can't have "." as method names

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM