Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

update updated_at time without changing anything

Is there any way I can touch a model causing the updated_at field to update to the current time without actually changing anything in the other fields?

like image 519
Deekor Avatar asked Aug 13 '14 19:08

Deekor


1 Answers

You can use touch

model.touch

or

model.touch(:updated_at) #or anyother timestamp attribute

Documentation here

like image 190
usha Avatar answered Nov 02 '22 04:11

usha