1

I am following railscast to generate complex form

I am receiving this error:-

 "Error: \"throw $continue\" is deprecated, use \"return\" instead"

Any idea?

I am receiving this error when I am trying to add a new question.

Mohit Jain
  • 43,139
  • 57
  • 169
  • 274
  • @mu is too short http://railscasts.com/episodes/197-nested-model-form-part-2 includes all the code.. check it.. let me know if its not fine.. I will paste the same code here. – Mohit Jain Aug 07 '11 at 23:28

1 Answers1

0

From railscast:--

def link_to_add_fields(name, f, association)
  new_object = f.object.class.reflect_on_association(association).klass.new
  fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
  render(association.to_s.singularize + "_fields", :f => builder)
  end
 link_to_function(name, h("add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")"))
end

Remove h in link_to_function ie

def link_to_add_fields(name, f, association)
  new_object = f.object.class.reflect_on_association(association).klass.new
  fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
  render(association.to_s.singularize + "_fields", :f => builder)
  end
 link_to_function(name, ("add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")"))
end
Mohit Jain
  • 43,139
  • 57
  • 169
  • 274