Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dash_if_blank on custom fields without a direct attribute on the model #308

Open
Paul-Bob opened this issue Nov 7, 2024 · 1 comment
Open

Comments

@Paul-Bob
Copy link
Contributor

Paul-Bob commented Nov 7, 2024

Add a link to dash_if_blank documentation page on the custom fields page. When defining a custom field like field :map, as: :my_map_custom_field, and the model lacks a map attribute (for instance, using separate latitude and longitude fields instead), the component renders a dash because no value exists for map.

This behavior can be confusing if not clearly documented, as users might not expect a dash to appear in place whatever he does on the component.

This renders a dash:

<%= field_wrapper **field_wrapper_args do %>
    hello
<% end %>

This renders "hello"

<%= field_wrapper **field_wrapper_args, dash_if_blank: false do %>
    hello
<% end %>
@Paul-Bob
Copy link
Contributor Author

Paul-Bob commented Nov 7, 2024

Discord discussion that originated this idea https://discord.com/channels/740892036978442260/1138182212655788054/1304111311084326953

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant