Hi I have a form where users enters their homepage-url. The problem is that some users don''t include the "http://" part of the url. So, when I use <%= link_to "external site", @user.homepage_url %> and @user.homepage_url is "www.homepage.com", Rails maps this to a internal site (which, of course, doesn''t exists). Is there a easy way to fix this, or do i need a method that checks for, and includes, the "http://" part of a url? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, 2007/4/8, thomma <thomma81-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> Is there a easy way to fix this, or do i need a method that checks > for, and includes, the "http://" part of a url?You should always store the http:// with the link. Try to validate your model width szh like this: web = "www.domain.de">> puts (web[0..7] != "http://") ? "http://#{web}" : webHTH, Beate --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
unless, of course, you want to allow https:// , or even mailto: , etc... On Apr 8, 12:22 pm, "Beate Paland" <bpal...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > 2007/4/8, thomma <thomm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > Is there a easy way to fix this, or do i need a method that checks > > for, and includes, the "http://" part of a url? > > You should always store the http:// with the link. Try to validate > your model width szh like this: > > web = "www.domain.de" > > >> puts (web[0..7] != "http://") ? "http://#{web}" : web > > HTH, > Beate--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---