mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-02-01 03:46:44 +01:00
don't use access
This commit is contained in:
parent
ec26c0e4d4
commit
7f309f649e
1 changed files with 4 additions and 2 deletions
|
@ -25,7 +25,7 @@ defmodule Philomena.Polymorphic do
|
||||||
def load_polymorphic(structs, {name, {id, type}}) do
|
def load_polymorphic(structs, {name, {id, type}}) do
|
||||||
modules_and_ids =
|
modules_and_ids =
|
||||||
structs
|
structs
|
||||||
|> Enum.group_by(& &1[type], & &1[id])
|
|> Enum.group_by(&Map.get(&1, type), &Map.get(&1, id))
|
||||||
|
|
||||||
loaded_rows =
|
loaded_rows =
|
||||||
modules_and_ids
|
modules_and_ids
|
||||||
|
@ -45,7 +45,9 @@ defmodule Philomena.Polymorphic do
|
||||||
|
|
||||||
structs
|
structs
|
||||||
|> Enum.map(fn struct ->
|
|> Enum.map(fn struct ->
|
||||||
row = loaded_rows[struct[type]][struct[id]]
|
type = Map.get(struct, type)
|
||||||
|
id = Map.get(struct, id)
|
||||||
|
row = loaded_rows[type][id]
|
||||||
|
|
||||||
%{struct | name => row}
|
%{struct | name => row}
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in a new issue