Autogenerate Link List (Painfully Newbie)

I'm struggleing in the early stages of learning RoR. I'm playing around with a simple blog format. I'm already stuck.

What I am trying to do is iterate over the titles of articles in my database, and list them. The article table has rows id, link, title, content. "Link" is actually what I would be using, incase I had a title that I thought was too long to make into a link, I would put a shorter version into the "link" row.

I imagine it must be something along the lines of :


<ul>   <% for link in Article.link_columns %>     <li><%=h article.send( %></li>   <% end %> </ul>


Of course, a: that doesn't work, and b: that wouldn't generate clickable links, but it's all I have at the moment.

Any suggestions?

    <% for article in @articles %>
  • <%= link_to(article.title, :controller => 'articles', :action => 'show', :id => [](, :link => %>
  • <% end %>

you need something like this in config/routes.rb

map.connect ‘/articles/show/:id/:link’, :controller => ‘articles’, :action => ‘show’, :id => nil, :link => nil