Tired of all the erb whitespace and those <%-end-%> madness ?
Switch to HAML for emails!!
How to?
- remove any leading whitespace with capture and gsub
- use == for easy string replacement
- use == for newlines
Example
==Hello #{@user},
Your order has been completed on #{Time.now}.
You may now access the bought items:
==
- content = capture do
- for item in @order.items
- if item.shipping?
We will send it to you soon.
- else
please download it here:
==#{item.orderable} -- #{polymorphic_url(item.orderable)}
==
=content.gsub(/^( )*/,'')
==
=mail_signature