mercredi 1 novembre 2017

Set a column data to another column in same model

Is there any shortcut method to set one column data to another in same model?

FYI I do know about for_each method in rails and I can implement that. However what I am trying to ask is if something like User.update_all(last_logged_at: last_sync_position) possible where last_logged_at and last_sync_position are columns of the model user

Also. This is not a migration file I am writing.

I have tried to search for the same but I got an answer in mysql but I am unable to figure out how to convert to rails way of it.

Aucun commentaire:

Enregistrer un commentaire