Ash.Error.Unknown.UnknownError: Invalid reference
I have this action in the
UserUpload resource. I added another criteria for filtering the resource by the first or last name of its user relationship. However, the String.contains? lines give this error:
The relationship and its first_name and last_name fields are public?: true
7 Replies
String.contains? is not valid in expressionsWhat should I be using instead
I'm checking the expressions guide 😄
It is just
contains/2
https://hexdocs.pm/ash/expressions.html#functionsThanks!
What's the best way to deal with the
search argument being nil or ""? I want to ignore it in those situationsThe way you're doing it now is reasonable, but often times "regular-old-elixir" is cleaner
I get
function Ash.Query.filter/1 is undefined or private even though I have require Ash.Query in the module
Ah, it's filter/2
How do I make it case-insensitive @Zach Daniel ? It doesn't like it when I try String.downcase(user.first_name) inside the expr
Based on https://hexdocs.pm/ash/Ash.Query.Function.Contains.html I also tried:
But this one doesn't compile
Sigh. string_downcase/1Something like this would also likely work: