lundi 1 juin 2020

pop record from ActiveRecord without deleting in database Rails 5.2

In rails 3.2 pop helps in removing the record from ActiveRecord.

rec = User.find(1).histories
rec.pop => remove last history and output class will be in ActiveRecord 

In Rails 5.2, same pop is not working.

Looking for same ActiveRecord class as output.

Also, the record should not be removed in the database.

Aucun commentaire:

Enregistrer un commentaire