“错误:\”抛出$ continue \“已弃用,请使用\”return \“而不是”

时间:2011-08-07 21:43:07

标签: ruby-on-rails ruby-on-rails-3 prototype railscasts

我正在关注railscast to generate complex form

我收到此错误: -

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

有什么想法吗?

我在尝试添加新问题时收到此错误。

1 个答案:

答案 0 :(得分:0)

来自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

在link_to_function中删除h,即

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