我無法完全理解這一點。你會如何將這種多線失敗轉化爲HAML?
原文:
<%=
Shasta::CSV.generate do |csv|
csv << ["Customer", "Job Name", "Payment Date", "Amount", "Notes"]
for payment in @payments
csv << [
payment.customer.name,
payment.jobs.map(&:name).join(" "),
I18n.l(payment.created_at, :format => :short_date),
number_to_currency(payment.amount),
payment.notes
]
end
end.html_safe
%>
HTML2HAML它轉換爲這一點,但它失敗
= Shasta::CSV.generate do |csv| |
csv << ["Customer", "Job Name", "Payment Date", "Amount", "Notes"] |
for payment in @payments |
csv << [ |
payment.customer.name, |
payment.jobs.map(&:name).join(" "), |
I18n.l(payment.created_at, :format => :short_date), |
number_to_currency(payment.amount), |
payment.notes |
] |
end |
end.html_safe |
當這樣的事情發生,它基本上給你,你應該重構它變成一個輔助的提示。 – James 2012-02-23 21:28:40