Model is
class MenuItem < ActiveRecord::Base
belongs_to :menu_item
has_many :menu_items
accepts_nested_attributes_for :menu_items
end
How to create a form with ability to add dynamically children and also children of children if needed (preferably with nested_form_for). In other words form shall be something like:
input
child input
child input (child of child)
add/remove child (child of child of child)
add/remove child (child)
add/remove input
Clicking add/remove will add/remove one more according child, how can I achieve this?
Aucun commentaire:
Enregistrer un commentaire