Bug? Trying to Enum.map list of changeset keep on getting '#'

Was curious if I stumble on a bug or I’m just crazy.

Here’s the code:

 175   defp id_records_changeset(changesets) do
 176     if is_nil(changesets) do
 177       changesets
 178     else
 179       changesets
 180       |> Enum.map(fn x -> x.id end)
 181     end
 182   end

The data:

[%Fumigate.Fragrance.Accord{
__meta__: #Ecto.Schema.Metadata<:loaded, "accords">,
accord_name: "almond", 
id: 35, 
inserted_at: ~N[2019-07-30 14:22:44], 
perfume_approvals: #Ecto.Association.NotLoaded<association :perfume_approvals is not loaded>, 
perfumes: #Ecto.Association.NotLoaded<association :perfumes is not loaded>, 
updated_at: ~N[2019-07-30 14:22:44]}]

I’ve check x.accord_name that works.

I’ve also done different list of changeset (not accord changeset but of company changeset) with a list of containing one company changeset and another list of two company changeset. The number of items in a list doesn’t affect it. Perhaps there’s something in accord changeset that’s causing it and not company changeset…

I’ve tried is_integer and IO.inspect within the Enum.map it returns correctly the id and true.

I have no idea why it’s returning #.

Thank you for your time.

iex(2)> IO.inspect [35]
'#'
'#'
iex(3)> IO.inspect([35], [charlists: :as_list])
[35]
'#'

Inspect.Opts

5 Likes

I’d suggest the use of i/1 in iex. It’s always a good thing to learn about charlists, as it explains both representation.

4 Likes