Ben
Ben

Reputation: 25

Rails 3 Make Text into a Clickable Link

I've made a Rails 3 app and I've got a form on my page in which I have users copy and paste a link and then submit it (much like Reddit) and then ideally, the link would appear on the main page for other users to click on. However, whenever users paste the URL's into my form, the link is not clickable, it is only text. Does anyone know any solutions for this? Any help would be greatly appreciated! Thank you!

Upvotes: 2

Views: 1425

Answers (1)

Mitch Dempsey
Mitch Dempsey

Reputation: 39899

So say your object is in @post

In the display, do <%= link_to @post.url, @post.url %>

That should "linkify" your URL so that users can click it.

Upvotes: 4

Related Questions