Links on page

hi all,

On my page i am displaying business url entered by user it stored in
database
(code is in haml)

= link_to @user.website,@user.website

if url stored in database is “www.abc.com

then on click of that link it goes to http://sarasaves/at/www.abc.com
and shows

Routing Error

No route matches “/at/www.moblie.com” with {:method=>:get}

I want user to go to only “http://abc.com

You may try link_to “www.abc.com”, “http://www.abc.com”.

Tim Teng wrote:

You may try link_to “www.abc.com”, “http://www.abc.com”.

but, i am taking different values of business_url from database
depending on user

You might want to (re)consider which is most appropriate to store for
your app’s current and future use.

FWIW,

Hassan S. ------------------------ [email protected]
twitter: @hassan

it’s working
Thnaks…

On Tue, Aug 25, 2009 at 11:52 PM, Nik
Cool[email protected] wrote:

On my page i am displaying business url entered by user it stored in
database
(code is in haml)

= link_to @user.website,@user.website

if url stored in database is “www.abc.com

I want user to go to only “http://abc.com

Those don’t match – do you want the URL to be ‘http://www.abc.com
or do you want to strip the ‘www’ out?

If you just want the ‘http://’ added,

should work.

And just for clarity – “www.abc.com” is a hostname, not a URL, which
requires a protocol (http, https, ftp, etc.).

You might want to (re)consider which is most appropriate to store for
your app’s current and future use.

FWIW,

Hassan S. ------------------------ [email protected]
twitter: @hassan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs