How to use variables inside a loop in haml?

How can I indicate the value of the file variable in the second line instead of both lines in the file ?

 - files.each do |file| %a(href="test?run=file")click file 
+4
source share
1 answer
 - files.each do |file| %a(href="test?run=file") click = file 

=== UPDATED ===

 - files.each do |file| %a(href="test?run=#{file}") click = file 

or use link_to instead of %a

 - files.each do |file| = link_to "test?run=#{file}" do click = file 
+7
source

All Articles