# Nuby: HABTM and drag-and-drop views

**URL:** <https://www.ruby-forum.com/t/nuby-habtm-and-drag-and-drop-views/55929>\
**Category:** Rails\
**Created:** [March 25, 2006, 2:25pm UTC](https://www.ruby-forum.com/t/nuby-habtm-and-drag-and-drop-views/55929 "2006-03-25T14:25:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 25, 2006, 2:25pm UTC](https://www.ruby-forum.com/t/nuby-habtm-and-drag-and-drop-views/55929/1 "2006-03-25T14:25:27Z")

</div>

I have two tables that have a HABTM relationship: Teacher  
has\_and\_belongs\_to\_many Groups, and Group has\_and\_belongs\_to\_many  
Teachers.

This is what I want: select a Teacher, and then drag Groups from one box  
to another to assign them to the teacher. Or, select a group, and drag  
and drop Teachers to assign them to groups. All using AJAX, (off  
course).

Only problem is, I don’t know even know where to start. Should I create  
a controller, a scaffold, or what-have-you??? Please help me!

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 26, 2006, 12:47am UTC](https://www.ruby-forum.com/t/nuby-habtm-and-drag-and-drop-views/55929/2 "2006-03-26T00:47:03Z")

</div>

My advice is to learn to crawl before you try to go ride the bike you  
have in mind…

Start with something simpler, such as just setting up the teachers  
table and it’s associated CRUD, then work from there. You could  
generate a scaffold for that, just to get a rough idea how rails likes  
to hand data entry, reading, updating and deletion. Don’t worry  
about the ajax stuff until you can do it all manually without the  
ajax.
