Search code examples
ruby-on-railshamllink-to

haml Ruby on Rails, add link into table


I'm trying to add a link into my table, group.link holds a URL and I want to make this into a clickable link. This is what I've tried to do so far but it isn't correct:

- @groups.each do |group|
  %tr
    %td= group.name
    %td= group.description
    %td= #{link_to group.link}

Thanks in advance!


Solution

  • Try this:

    - @groups.each do |group|
      %tr
        %td= group.name
        %td= group.description
        %td= link_to "Click", group.link