bgadoci
bgadoci

Reputation: 6493

Rendering as hyperlink Ruby on Rails

I am new to rails so sorry for stupid questions. I have created section of the website I am working on where the client can post news about their clients. In the entry view I collect title:string content:text and link:string. How do I render the link:string as an actual link in the show and index views.

Upvotes: 0

Views: 678

Answers (2)

Jason Yanowitz
Jason Yanowitz

Reputation: 398

You should be careful about taking user input without sanitizing it. You can open yourself up to XSS attacks and the like (http://en.wikipedia.org/wiki/Cross-site_scripting). I would look at something like http://railspikes.com/2008/1/28/auto-escaping-html-with-rails as part of your project.

Upvotes: 0

Jeff Paquette
Jeff Paquette

Reputation: 7127

you're looking for the link_to helper. In your view you would do something like:

<%= link_to "some text", "http://example.com" %>

Upvotes: 1

Related Questions