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
on 2009-05-26 12:26
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.
on 2009-05-26 21:12
Just <%= link_to title, url %> greetings, mike 2009/5/26, Sean Six <email@example.com>: > am confused. > -- > Posted via http://www.ruby-forum.com/. > > > > -- Von meinen Mobilgerät aus gesendet
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