railscast#196,197 Nested Model Formをrails4で動かす

http://t-taira.hatenablog.com/entry/20110420/1303310783
を元にしてstrong parameterがあるとうまく動かないのでしょうがなく

    def category_params
      params.require(:category).permit!
    end

してやり、DEPRECATION WARNINGが今後のことを考えると怖いので

DEPRECATION WARNING: link_to_function is deprecated and will be removed from Rails 4.1. We recommend using Unobtrusive JavaScript instead. See http://guides.rubyonrails.org/working_with_javascript_in_rails.html#unobtrusive-javascript. (called from link_to_remove_fields at /Users/seijirou/Dropbox/code/ruby/rails4/Nested/app/helpers/categories_helper.rb:3)
    #link_to_function(name, raw("add_fields(this, \'#{association}\', \'#{escape_javascript(fields)}\')"))
    link_to name ,'javascript:void()',:onclick => ("add_fields(this, \'#{association}\', \'#{escape_javascript(fields)}\')" )

としてやるととりあえず動作した。これはかなり使うことになる。
参考:
http://railscasts.com/episodes/196-nested-model-form-part-1
http://railscasts.com/episodes/197-nested-model-form-part-2
http://t-taira.hatenablog.com/entry/20110420/1303310783
http://stackoverflow.com/questions/15919761/rails-4-nested-attributes-unpermitted-parameters