开发者

How can I make errors in HAML (Rails) show me the exact line where the error occurred?

开发者 https://www.devze.com 2022-12-10 04:04 出处:网络
NoMethodError in course_templates#index Showing app/views/course_templates/index.haml where line #6 raised:

NoMethodError in course_templates#index

Showing app/views/course_templates/index.haml where line #6 raised:

undefined method `new_course_template' for #<ActionView::Base:0x237c3e4>

Extracted source (around line #6):

3: - c开发者_Python百科ontent_for :sidebar do  
4:   %ul.links  
5:     %li= link_to "Add a Template", new_course_template(@provider)  
6:   
7: - content_for :main do  
8:     = page_entries_info @templates  
9:

See it says "around line #6", and the error is on line 5. This example isn't too bad...but errors in more complex views or in helpers are almost impossible to find right away. Is there a configuration that I'm missing?


This is a bug that I believe should be fixed in the soon-to-be-released Haml 2.2.11. If you wouldn't mind trying this out with the Haml stable branch to see if that makes the line number correct, I would appreciate it greatly.

0

精彩评论

暂无评论...
验证码 换一张
取 消