Forum: Ruby on Rails Two link Questions

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Sean S. (Guest)
on 2009-05-26 14: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, I want this to be shorted
automatically to
Sean S. (Guest)
on 2009-05-26 20: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.
mike (Guest)
on 2009-05-26 23:12
(Received via mailing list)
Just <%= link_to title, url %> greetings, mike

2009/5/26, Sean S. <removed_email_address@domain.invalid>:
> am confused.
> --
> Posted via
> >

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