Connecting Tech Pros Worldwide Forums | Help | Site Map

HABTM population from text fields

Newbie
 
Join Date: Mar 2008
Posts: 2
#1: Mar 21 '08
Hi. I'm having problems wrapping my head around the use of HABTM. I just
haven't found a good enough reference for dealing with HABTM-linked
models, and my business logic is full of them.

In this case, I have a model Initative and a model called Reference for
associating one or more reference documents to an Initative. Any
Reference document could also be referenced by any number of Initatives.
So Initative has objects/columns Initative_ID and also Ref_Num:String.
I have declared HABTM in each model.

I need a straighforward way for a user to enter associated documents
from the context of an Initative record form. I would think that an
editable dropdown would be one way, which would allow the user to select
a Reference already in the database or allow them to enter a new one. I
also would settle for some version of a text field or text area with a
"Add Reference" button. I would even consider a popup form with some
version of these controls.

Being that all of the HABTM references I have seen seem to be really
checkbox-focused, I haven't really seen anything that gives me a good
idea how to go about this. I have done similar things in Access and
Notes, but can't quite figure out the HABTM syntax well enough to do it
in Rails.

Newbie
 
Join Date: Mar 2008
Posts: 2
#2: Mar 21 '08

re: HABTM population from text fields


Slight typo in my original post.

What I meant to write is that my Reference model has fields Reference_ID (:int) and Ref_Num(:string)
Reply