Hi,
I am making a twitter clone. What I need to do is, when displaying the contents of a post/'tweet' I need to insert links to a users page wherever he is mentioned (@<username>) and link to a hashtag wherever it is mentioned (#<hashtag>).
It occured to me I could parse the contents in the Post models beforeSave()
function and add the html tags to be stored in the database, but the problem with that is that is if I change the routing I'll have a database full of incorrect links, and I need the database to be without them for the API.
I could also hardcode the path up to the <username> or <hashtag> part, but that just seems like a bad idea. So how should I do it?