-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crashing on a struct that gets persisted as JSON #17
Comments
Hey @bhuntpenn
It will work to the next invocation of the query that causes the error :) I'd go with this: defimpl Ecto.DevLogger.PrintableParameter, for: [Cheese.Assignments, Cheese.Assignment, Cheese.Member] do
def to_expression(x) , do: to_string_literal(x)
def to_string_literal(x), do: Jason.encode!(Map.from_struct(x))
end |
Thanks for the help @fuelen ! |
@bhuntpenn I just want to add, that there was one small bug with map representation, the end result has to be wrapped in quotes 486c2bb |
Hey @bhuntpenn |
Hi there, I add
Ecto.DevLogger.install(Brybags.Repo)
to myApplication.start/2
callback, and start the application.The following crash is logged to the terminal.
I then install the handler manually,
Ecto.DevLogger.install(Brybags.Repo)
and everything works fine.I was thinking, perhaps I should implement a
PrintableParameter
like such, but doesn't seem to have taken effect (I did edit the dep source code directly, but in any event, I'm not sure what approach I should take).Or would I have to do something like this?
I'm asking because I'm wondering if I can add something to improve first-time user experience, it works fine by manually running
Ecto.DevLogger.install(Brybags.Repo)
- but I'm thinking of the next person.The text was updated successfully, but these errors were encountered: