This is a beginning Rails question. I have two models, Member and
Organization, in a one-to-many association. (An Organization can have
many
Members.) The problem is I’m not sure how to design a view/controller
that
allows the user to associate an existing Member to an Organization. One
way
is to create a big HTML Select tag containing Member.all, and allow the
user to pick the Member he wants to add. This is easy to do, but there
could be hundreds or even thousands of Members, so it’s not very
scalable.
An alternative idea is to create a separate “ChooseMemberController” and
pop up its view in a new browser window. The view would show a paginated
list of all Members, which solves the scalability problem. But I don’t
know
how to communicate the user’s selection back to the original calling
controller. Also, a pop-up window might not be the best user experience.
I’ve been searching for any tips on handling this situation. All I’ve
found
is this Rails
Recipehttp://media.pragprog.com/titles/fr_arr/multiple_models_one_form.pdf,
which is very close to what I’m trying to do, but unfortunately it
doesn’t
show how to pick an item from a potentially large table.
Can anyone point me to an example or give me some idea of how to
implement
this? Thanks!