Domanda

I'm very new to haml, i need it to do rails project. I don't understand why this code does not provide clickable link in the header of column. For example:

  %table#movies
    %thread
       %tr
         %th <%= link_to "Name", :sort => "name" %>
         %th Year
         %th Rating

and so on...

All it displays is just plain text of what I wrote instead link in Name column. This is probably extremely stupid question, but I could find solution anywhere, sorry

Or if there is a way to send :sort parameter within simple html 'a' tag, could you please tell. Thanks.

È stato utile?

Soluzione

If you want to append rails output to html tag you must use another syntax (http://haml.info/docs/yardoc/file.REFERENCE.html#inserting_ruby_)

Change

%th <%= link_to "Name", :sort => "name" %>

to

%th= link_to "Name", :sort => "name"

Altri suggerimenti

try this out

%th=link_to "Name", "#" ,:sort => "name"
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top