Searched through and didn’t find any good resources/tutorials, if someone could please explain how to generally get this done/how it would work or even point me to a direction
I am wanting to display a notice that says ‘new Comments’ were made since the last time a user was logged in. This notice will appear on the dashboard the next time they login in.
I read somewhere that I may need to make a ‘last_action’ column in the User table, but they didn’t clarify much after that.
Yes, you add another column to your
userstable, called exactly that,last_action_at. When user performs any activity (navigates to pages, clicks buttons, etc), you write the time of the action to that field.Then later, when he logs in, you fetch that value (which would be time of the last action in his last visit) and select all comments that have
created_atgreater than this value. Now you have all data necessary to render thatnotice.