Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Active object and query

Z-EL May 2, 2018
Hi,
I'm trying to import a file and inject it in dataBase.

Each time,i need to verify if the object exist in database,to create or update the object.

What is the best scenario to do this without reducing performances.

Thanks.

1 answer

0 votes
Kubilay Karpat [Snapbytes]
Contributor
July 30, 2018

Hi Z-EL

If you are querying your table with a field and then checking if there is a record or not then you might simply you ActiveObjects::count method to check the number of records matching your query this way you don't have to fetch the object from DB each time.

Suggest an answer

Log in or Sign up to answer