Letting users post link shouts

I’ve got to the part where users are able to post pictures and text shouts.But I would like them to be able to post (shortened) hyperlinks to external pages as well, what would be the best approach to do that? This would somehow involve manipulating the user input and returning it as a link…

This question is very vague, so I’m not sure how to help you. Can you edit your post to add some clarifying details?

I have added some more info!

Any thoughts here @halogenandtoast? I’m not familiar with the app in question.

@Thomas_Roest do you want existing text shouts to have links in them or do you want a new type of shout that has links. Either way you might want to take a look at the auto_link gem https://github.com/tenderlove/rails_autolink

thank you, I would like the text shouts to have links in them, so how would I use this gem in the shouter app?

Should be as simple as requiring the gem and then when you render a TextShout calling auto_link(text_shout.body)

Thank you for you reply! I wonder if you could help me with this situation.

I’m trying to shorten the links that are posted with bitly and the bitly gem.

To render the posts/shouts with links I used the following code ( auto_link gem).


I also managed to render a bitly url by using the bitly api and bitly gem;


Now I could not figure out how to automatically shorten the links that are posted, by replacing the hardcoded url. Is there a way to do this?