Some tips on debugging ERB Templates
Convert the template to a ruby file
$ erb -x -T - file.erb > file.rb
Open the file. At the bottom, you'll see:
; _erbout
Add a puts in front of this, so instead of returning the output, it is displayed
; puts _erbout
If there are variables out of scope that need to be referenced, add them to the top. Now you can run the script directly and investigate the errors.
$ ruby file.rb