Execute ruby code in a link in Haml

Posted by thermans on Stack Overflow See other posts from Stack Overflow or by thermans
Published on 2010-04-09T15:28:57Z Indexed on 2010/04/09 16:43 UTC
Read the original article Hit count: 220

Filed under:
|

I want to have a "delete user" link in a normal Activerecord table, but I can't figure out how to wrangle the inline ruby in haml.

I have this:

   %tbody
    - @users.each do |user|
      %tr
        %td= user.name
        %td= user.login
        %td
          %a
            %img{:src => '../images/delete.png', :title => 'Delete user'}

How do I make the

- user.destroy

be a clickable link in Haml?

© Stack Overflow or respective owner

Related posts about haml

Related posts about ruby