Forum: Ruby on Rails Two link Questions

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ee4ead180a47f98999854b3e1eef7638?d=identicon&s=25 Sean Six (seansix)
on 2009-05-26 12:26
I want a user to be able to submit a link to an outside website.  If it
is an article titled say "Lakers lose to Denver." from the New York
Times, I want to create a link to the article, but have the title of the
button be the name of the article.

Also I want to include the source website, but have it not be a button.
If the user submits a link that says
www.nyt.com/sports/basketball/32445, I want this to be shorted
automatically to www.nyt.com
Ee4ead180a47f98999854b3e1eef7638?d=identicon&s=25 Sean Six (seansix)
on 2009-05-26 18:42
I have the information stored in a table called articles.  The title is
under "title" and the url under "url"

I can use the auto_link method with url, for example:
<%= auto_link @article.url %>

I want the button to say the title field, but link to the url field.
I thought it might be something like <%= auto_link 'title', 'url' %>
But I guess I need to write some kind of helper method, which is where I
am confused.
A59b0daee5e5570e07a9f976721017e7?d=identicon&s=25 mike (Guest)
on 2009-05-26 21:12
(Received via mailing list)
Just <%= link_to title, url %> greetings, mike

2009/5/26, Sean Six <rails-mailing-list@andreas-s.net>:
> am confused.
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

--
Von meinen Mobilger├Ąt aus gesendet
Ee4ead180a47f98999854b3e1eef7638?d=identicon&s=25 Sean Six (seansix)
on 2009-05-27 04:40
If I try this: <%= link_to(@article.title, @article.url) %>
I almost get it.  Say the title is "google" and the url is
www.google.com; I get a button that says google, but it links to
localhost:articles/1/www.google.com, not www.google.com
This topic is locked and can not be replied to.