I'm a RoR newbie, and I'm attempting to figure out how to get the gsub method to add html to my page. Specifically, I'm attempting an exercise that, like Twitter, will route to an action that will list a Users tweets by linking their username. So, the string @username within the content property will link to /tweets/username listing out of the user's tweets. I have the action and route completed, but I can't get the gsub to work correctly. Here's what I thought would work
<%= content_tag :p, twet.content.gsub(/@[a-zA-z0-9]/, <html code here>)%>
but it doesn't. The html renders as text. To try to get around this, I also tried to create a link_to helper method using the $1 variable
<%= content_tag :p, twet.content.gsub(/@[a-zA-z0-9]/, link_to(("#{$1}", user_tweet_path($1)))%>
but that isn't working either. I've read other posts and learned that rails may not print html due to malicious code protection and $1 gets set after the sub, so I'm lost on how to make this work.