application_helper.rb ファイルにヘルパー関数があります。
def nested_attributes(attributes, cn = controller_name.classify)
attributes.map do |attribute, sub_attributes|
content_tag(:ul) do
content_tag(:li, :id => cn+"[#{attribute.id}]") do
raw(attribute.name+nested_attributes(sub_attributes))
end
end
end.join.html_safe
end
そして、私はそれをビューから呼び出します:
<%= nested_attributes @categories.arrange, 'baget_category_id' %>
しかし、結果を確認すると、'baget_category_id' の代わりにコントローラー名 (デフォルト値) を取得しました。デフォルト値を削除すると、エラーが発生しました: 引数の数が間違っています (1 対 2)。私が間違っていることは何ですか?