我有这个each
循环:(haml)
- @deals.each do |a|
.slide
%a{:href => "#"}
- a.attachments.each do |a|
= image_tag(a.file.url, :height =>"325px", :width =>"650px" )
.caption{:style => "bottom:0"}
= a.description
因为是我用来生成图像链接的@deals
3 个表(模型)的组合查询。polymorphic_path
- @deals.each do |a|
.slide
%a{:href => "#"}
- a.attachments.each do |a|
= image_tag(a.file.url, :height =>"325px", :width =>"650px" ), polymorphic_path(@region, @city, a)
.caption{:style => "bottom:0"}
= a.description
但这会产生region_city_attachment_path
不正确的结果。第一个每个循环a
变量存储正确的值,但我怎样才能在第二个循环中reach
的第一个a
变量each
?