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

Add support for serial ids in HasMany field #478

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

thomasfortes
Copy link
Contributor

Add a match function that handles when option.id is represented as an integer in the HasMany field.

Closes #451 ?

@Flo0807
Copy link
Collaborator

Flo0807 commented Jul 23, 2024

String.to_integer may throw an argument error. Do you see any problems with converting the integer to a string instead of the other way around?

Like this:

defp match_option_to_id(option, id), do: to_string(option.id) == to_string(id)

@thomasfortes

@thomasfortes
Copy link
Contributor Author

thomasfortes commented Jul 23, 2024

It works just fine with to_string and is even simpler because we can remove the functions and just change inside the handle_event.

The only thing that I can think of is that when the internal representation is guarded to be an integer and String.to_integer fails it probably means that something else is wrong and knowing it earlier is better than letting it fail silently.

What do you think?

@Flo0807 Flo0807 added the bug Something isn't working label Jul 26, 2024
@Flo0807
Copy link
Collaborator

Flo0807 commented Jul 26, 2024

The only thing that I can think of is that when the internal representation is guarded to be an integer and String.to_integer fails it probably means that something else is wrong and knowing it earlier is better than letting it fail silently.

True! Let's try it with your solution 👍

@Flo0807 Flo0807 merged commit 1962b76 into naymspace:develop Jul 26, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Process crash when selecting a value in ManyToMany field
2 participants