Closed lasseebert closed 5 years ago
I don't believe that's intentional and I wasn't even aware that the def foo(model), do: model.bar
version worked. It looks like that's happening here https://github.com/vt-elixir/ja_serializer/blob/master/lib/ja_serializer/dsl.ex#L242-L243
If possible, I think it makes sense to support the single argument relationship so it's consistent. I would be happy to accept a PR for that. Thanks!
In a view, one can specify a custom attribute in two ways:
For relationships only the first way works:
This inconsistency caught me and I spend some time figuring out what was wrong. (Especially because the default behaviour just defaults to
nil
if a function or attribute is not found).Is this intended? Otherwise I will happily make a PR making it consistent.