0

I'm new to middleman and ruby so the syntax is very unfamiliar. I have setup a simple list page and a dynamic article page. This all works fine, but how do i generate the dynamic URL in link_to?

My list page is at localhost/list/ And my dynamic article page should be localhost/list/1/ where the number is dynamic.

<% data.list.each do |b| %>
    <%= link_to 'Read more', '/list/b.id.html' %>
<% end %>

How can I generate the dynamic URL?

Flexo
  • 87,323
  • 22
  • 191
  • 272
Trj
  • 657
  • 9
  • 21

1 Answers1

1
<%= link_to 'Read more', '/list/' + b.id.to_s + '.html' %>
Trj
  • 657
  • 9
  • 21