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.
|
|
March 21st, 2008 09:04 PM
# 2
|
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)
Not the answer you were looking for? Post your question . . .
182,256 Experts ready to help you find a solution.
Sign up for a free account, or
Login (if you're already a member).