How to update updated_at only

682 views
Skip to first unread message

Alex Kaminsky

unread,
Nov 18, 2015, 3:33:58 PM11/18/15
to elixir-ecto
I'm looking for a way to update the updated_at timestamp without actually updating other fields.  Something similar to a `touch` method.  What is the simplest way to do this?

José Valim

unread,
Nov 19, 2015, 12:07:48 PM11/19/15
to elixi...@googlegroups.com
You can pass a force: true option when you call Repo.update with an empty changeset and that should be enough.



José Valim
Skype: jv.ptec
Founder and Director of R&D

On Thu, Nov 19, 2015 at 4:33 AM, Alex Kaminsky <alexander....@gmail.com> wrote:
I'm looking for a way to update the updated_at timestamp without actually updating other fields.  Something similar to a `touch` method.  What is the simplest way to do this?

--
You received this message because you are subscribed to the Google Groups "elixir-ecto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-ecto...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-ecto/942d1df6-59f5-4bc6-a994-4e445cdd8259%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alex Kaminsky

unread,
Nov 19, 2015, 1:54:20 PM11/19/15
to elixir-ecto, jose....@plataformatec.com.br
Great! Thank you.
Reply all
Reply to author
Forward
0 new messages