Sounds like you need some Javascript.
You should be able to use Javascript to manipulate a hidden field that will
contain an array of items, or their ids. You will need to get your hands dirty
with Javascript, I see no other "DOM-oriented" way to do it.
if you're not opposed to Jquery I'd
You'll have to assign the values you get back (in JavaScript) to a
properly-named form element in your form. Try making a hidden input in the form
with the name set to meal[meal_item_ids]. Then locate that field in JavaScript
in your callback function (which fires after the drop event) and set
I understand that part Walter. I have done many nested forms. However,
this is the first one with a drag and drop feature.
The part I am struggling with is how to populate the array that gets passed
back through the drag and drop events.
I have the strong params setup and could easily just
I'm not sure how your form is constructed at the moment. But if you were
passing the result of the dragged items back to a meals_controller, you could
assign the array of values to `menu_item_ids` and the child menu items would be
created and assigned. You'll have to ensure that you whitelist
What happens now when you drop the element? Do you see anything in your
browser's JavaScript console indicating that the drop event fired? Did you do
anything beyond CSS (to make it look a particular way) to define the draggable
and droppable behaviors for these elements? Do the draggable
I have an app in production that I am adding a module to for Lunch Ordering
What I have is a Menu, which has Meals, and the Meals have Meal Items in
Categories like Entree, Vegetable, Fruit, and Drink
What I would like to do it allow Drag and Drop to build meals, and Drag and
Drop to build
6 matches
Mail list logo