2009/8/26 AnhHung <[email protected]>: > > Hi, > > I have a User table that has a Website column. > > In the form I would have the user type in the URL to their website. > > If they type the full-blown address "http://www.example.com" then > "link_to @user.website, @user.website" will work out of the box. > > However, if they type in "www.example.com" then the above code would > display something like: localhost:3000/controller/action... something > like that. > > How do I make it that no matter what the user type it, link_to would > take them to an external site? > > Sorry if this sounds like a too basic question. >
You could check what the user enters and add the http:// if they have not provided it, either on the way into the database or out of it. Colin --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

