我有此each
循環:(HAML)每個循環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
循環?