17 May 00:34
auto url formatting?
From: Danimal <fightonfightwell@...>
Subject: auto url formatting?
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-05-16 22:36:43 GMT
Subject: auto url formatting?
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-05-16 22:36:43 GMT
Hello! I'm having a bear finding this, so I thought I'd just ask... If I want to capture "website" as a user field (i.e. in a contacts database)... is there an easy, automatic way to properly format it for a link_to tag regardless of whether they include the "http" or not? I.e. some helper or something that someone has that I could do something like: <%= link_to @user.website, format_url(@user.website) %> And it would turn: "www.google.com" # => "http://www.google.com/" but also: "http://www.google.com" # => "http://www.google.com/" and: "ftp://ftp.google.com" # => "ftp://ftp.google.com/" I imagine there are some code snippits for doing this... I just haven't found one yet. Thanks! -Danimal --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@... To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
RSS Feed