Mix phoenix.gen.html with map field type

I am using Phoenix with Ecto 2.0. I was surprised that I can pass it to the my_field:mapgenerator, and it correctly creates a model with a map.

It also generated a view, and the field is just a string input, which does not allow validation because the line is not a map.

Is there a format for this string to be converted to a map?

I know that there is no standard way to edit maps using HTML. Curiously, it would be nice to parse the string automatically in the generated code. Thus, the generator will always create a working solution.

+4
source share

Source: https://habr.com/ru/post/1629864/


All Articles