Conversation
… / :naive_datetime)
|
hey @narrowtux thanks for your PR. I'll take a look as soon as possible. |
|
@narrowtux thanks you for your PR. We'll take a look ASAP. |
|
@narrowtux also, I think it's missing some tests, especially related to Schema. |
| Returns a changeset ready for Repo.update | ||
| """ | ||
| def lock(user, locked_at \\ NaiveDateTime.utc_now()) do | ||
| def lock(user, locked_at \\ nil) do |
There was a problem hiding this comment.
why not use Config.datetime_module().utc_now() as a default param?
There was a problem hiding this comment.
I believe that default parameters are decided at compile time - then all locked users would have the same locked_at date.
There was a problem hiding this comment.
Maybe I got this wrong - this suggests that the expression is only evaluated when needed: https://elixir-lang.org/getting-started/modules-and-functions.html#default-arguments
There was a problem hiding this comment.
yeah, look:
defmodule MarsRover do
def time(foo \\ NaiveDateTime.utc_now()) do
foo
end
end
iex [1] > MarsRover.time
~N[2019-06-20 13:58:51.149503]
iex [2] > MarsRover.time
~N[2019-06-20 13:58:52.923541]
iex [3] >
Again, thank you! <3
This PR adds the possibility to configure the DateTime module used to generate
utc_now()datetimes and the types of all datetime fields in the user schema.config.exsuser.ex