Best Way to Design Resources Properties
Hello. Firstly, this is a great community: friendly and responsive.
Secondly, I have a question that, I hope, is not silly.
Suppose I want to have a resource named Evals. In it, I want to have the attributes: description, and numeric, where each description corresponds to a specific numeric value.
My questions are:
1. What would you recommend: making an attribute of type map, or separating the two parts of the map into 2 attributes?
2. If I use the map type for the attribute, does it make sense to specify that I want only one by saying one_of: Map.to_list(my_map)
5 Replies
Could you give me an example of what the data might look like?
Like that?
Yes, Sir
I'd suggest creating an "embedded resource" with the
numeric
and description
attributes. Then, I'd suggest declaring your attribute like attribute :evals, {:array, YourEmbed}
.Aha. I'll try that. Thanks, Zack.