Ash FrameworkAF
Ash Framework8mo ago
106 replies
mcoll

Ash.Type.Tuple Enumerable not implemented

I have an attribute of type :tuple defined like this:

    attribute :model, :tuple do
      constraints [
        fields: [
          alpha: [type: :float, description: "The alpha parameter for the beta model"],
          beta: [type: :float, description: "The beta parameter for the beta model"],
          t: [type: :float, description: "The half life of the fact in days"],
        ]
      ]
      allow_nil? false
      default fn -> Katarineko.Srs.default_model(1, nil, nil) end
    end


When I create an instance of this model

fact = Katarineko.Learning.create_fact


I get this error
{:error,
 %Ash.Error.Unknown{
   bread_crumbs: ["Error returned from: Katarineko.Learning.Fact.create"], 
   changeset: "#Changeset<>", 
   errors: [
     %Ash.Error.Unknown.UnknownError{
       error: "** (Protocol.UndefinedError) protocol Enumerable not implemented for type Tuple\n\nGot value:\n\n    {3.0, 3.0, 1.0}\n",
       field: nil,
       value: nil,
       splode: Ash.Error,
       bread_crumbs: ["Error returned from: Katarineko.Learning.Fact.create"],
       vars: [],
       path: [],
       stacktrace: #Splode.Stacktrace<>,
       class: :unknown
     }
   ]
 }}


Is this expected? Am I doing something wrong?
Was this page helpful?