Displaying external url's

I am a rails beginner and I am having trouble displaying external urls on view.

This is what i have in DB for ex: www.rubyonrails.com, if i try to construct the url on the page using link_to the url formed is - http://localhost:3000/www.rubyonrails.com.

Can someone help me in fixing this issue.


<%= link_to @from_DB.name_url, "http://www.rubyonrails.com", {:target => "_blank" } %>

is it your solution?


Reinhart http://teapoci.blogspot.com

I tried that, but still doesn't work , the url formed is http://localhost:3000/www.rubyonrails.com This is what i have in the view

<% @url_list.each do |u| %>   <%= link_to u.url, "www.rubyonrails.com", {:target=>'_blank'} %> <% end %>

What do you want your url like ?


IF YES, flow to here :


Add it :

map.web_url ':url_name',             :controller => 'my_controller', :action => 'my_action'

in your view :

<% @url_list.each do |u| %>    <%= link_to u.url, :action=>'my_action', :url_name => u.url %> <% end %>

It will make your url in address bar to be http://localhost:3000/www.rubyonrails.com

BUT THE SCRIPT BELOW, for accessing external url with new windows.

<% @url_list.each do |u| %>   <%= link_to u.url, u.url, {:target=>'_blank'} %> <% end %>

Reinhart http://teapoci.blogspot.com

Hi there,

Try putting the http:// before the URL