Reputation: 4432
I am working my way through Crafting Rails and in Chapter 4 I made a handler for "merb" templates—markdown with erb interspersed. This can be compiled into text or html, so it's perfect for mail. My "new_submission" Notification email has one template in app/views/notifications/new_submission.merb. Then in app/mailers/notifications.rb, all you need to do is
mail(:to => Person.editor.email) do |format|
format.text
format.html
end
And the single .merb template gets compiled into both the text and html part of a multipart email. Woohoo! You can read more about this in an excerpt from Crafting Rails, and you can browse around my specific implementation of it.
I updated my Gemfile about a week ago, and thought I got everything working because my pages were loading and Compass and Sass were no longer grumbling at me. For some horrible reason I didn't run any of my tests. But it turns out I've been getting this error since then whenever I call an action (such as "packlet.destroy") that tries to send this new_submission email:
ActionView::Template::Error (undefined method `children' for nil:NilClass):
app/mailers/notifications.rb:25:in `block in new_submission'
app/mailers/notifications.rb:23:in `new_submission'
app/models/submission.rb:62:in `has_been'
app/models/packlet.rb:20:in `destroy'
app/controllers/packlets_controller.rb:27:in `destroy'
Line 26 of app/mailers/notifications is the "format.html" line, shown above.
I have narrowed this down to a problem with haml/sass 3.1 by doing this bundle update more granularly. I updated Rails, ran my tests, no problems. I updated haml, ran my tests, and this pops out in four places.
Any guidance would be greatly appreciated.
Upvotes: 0
Views: 700
Reputation: 4432
This is a known issue in Haml 3.1, caused by nesting content within comments. (I learned this from haml's creator himself.)
Upvotes: 3