I think the lack of template caused the problem of "undefined local variable or method `dirname'"