views:

144

answers:

1

Hey all, 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 << render(: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.

A: 

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.

John Topley
So in the haml file, the # also indicates commenting?#fields << render_sequence_nav(sequence_info, students_path)I wasn't sure if that # was commenting out, an indication of an id selector, or something else.
JohnMerlino
Would you happen to know why this gives an undefined method join error in erb and not in haml: <% fields << render(:partial => "resources_partials/sequence/nav", :locals => sequence_info.merge({:cancel_url => {:controller => :dashboard}})) %>
JohnMerlino
Sorry, in Haml # indicates the ID attribute of an element as you state. I don't know the answer to your new question.
John Topley
Did I convert this line of haml to erb correctly above? #fields << render_sequence_nav(sequence_info, students_path)
JohnMerlino
That doesn't make sense as a line of Haml because it's trying to append the results of the `render_sequence_nav` method into an element with the ID of `fields`.
John Topley
Render form is defined in resources_form_helper.rb: def render_form %Q{<ul class="form">\n#{ yield.join "\n\t" }\n</ul>\n} endThis might have something to do with join error.
JohnMerlino