mercredi 24 juin 2015

Where to store business data?

I have a Rails app using MongoDB. I'll expose one single case although there are many others that would fit.

I've got a User model. Some User fields:

:first_name
:last_name
:email
:password_hash
:avatar
:roles

Sometimes it is interesting for us to know some data about how users interact with our app. For example, we want to know how many visits each user gets. What I thought about is to make a POST from client. Every time a user visits someone's profile a field inside that profile's owner (User) would be incremented.

Therefore, we can run reports based on that "stats".

One of my team-mates argues that that isn't a good practice as we'd end up with lots of requests all over the app. How people usually do this? Is it a good practice to make POST requests via AJAX and store it in database?

Thanks.

Aucun commentaire:

Enregistrer un commentaire