undefined method error appears in erb but not haml
All I wanted to do was convert a haml file to erb. After doing so, i get an undefined method `render_sequence_nav' error message. Even though no such error happened when it was in haml format. In the haml file, there is this line:
#fields << render_sequence_nav(sequence_info, students_path)
fields << rend开发者_Python百科er(:partial => "resources_partials/sequence/nav", :locals => sequence_info.merge({:cancel_url => {:controller => :dashboard}}))
= render_form { fields }
If I remove # from #fields, it will return undefined method render_sequence_nav in haml. So obviously that is needed. However, I can't recreate that in erb. If I add the hash, it grays out the line:
<% #fields << render_sequence_nav(sequence_info,
students_path) %>
<% fields << render(:partial =>
"resources_partials/sequence/nav", :locals =>
sequence_info.merge({:cancel_url => {:controller => :dashboard}})) %>
<%= render_form { fields } %>
<% end %>
Any ideas on how to address this? Thanks.
Your question is slightly confusing because you state that the error didn't occur when using Haml for the view, but in the second paragraph you write that you get the error using Haml if you uncomment the fields
line.
Rails is looking for a view helper method named render_sequence_nav
. This should be located in app/helpers/application_helper.rb
or whichever helper corresponds to the controller for this view.
精彩评论