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.

Thanks

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

is it your solution?

Rgd,

Reinhart
http://teapoci.blogspot.com

What do you want your url like ?

http://localhost:3000/www.rubyonrails.com

IF YES, flow to here :

{RAILS_ROOT}/config/route.rb

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

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 %>

On Apr 19, 2:05 am, Visit Indonesia 2008 <rails-mailing-l…@andreas-

Hi there,

Try putting the http:// before the URL

MD

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