Kevin, thanks for the input and the advice.

When I add the following code to application.dryml, I get the exact
same form which is to say that I can add Bars to Foo, but only Bars
that I create on the new or edit Foo form, i.e. I cannot add
previously created Bars.

<extend tag="form" for="Foo">
  <old-form merge>
    <field-list:>
      <bars-view:>
        <select-one:/>
      </bars-view>
    </field-list>
  </old-form>
</extend>

If I remove the : from the select-one tag, I get a stack trace leading
me to rapid_forms.dryml:645, claiming that view_hints is undefined.
view_hints is used there to to give the name of the model when no
objects of that model exist, but I have 3 Bars already created.

On Apr 29, 5:09 pm, kevinpfromnm <[email protected]> wrote:
> kinda slipped my mind, but generally you should make your models match
> what the data should do and not tweak them to get different views.
> databases tend to get ugly enough without view problems creeping in as
> well.
>
> On Apr 29, 3:06 pm, kevinpfromnm <[email protected]> wrote:
>
>
>
>
>
> > you can change which input method to use and thus can have the select-
> > many option you described.  just extend the form for invitation and
> > change the field-list view for contacts to use I believe you described
> > the select-many input but check-many might work too.
>
> > On Apr 29, 1:16 pm, Jeremy Savoy <[email protected]> wrote:
>
> > > In fact, following the simple fooBar application outlined at this URL:
>
> > >http://cookbook.hobocentral.net/manual/multi_model_forms
>
> > > I cannot get this to work properly. Foo has_many bars, but even if you
> > > create 10 bars, when you create a new Foo, you can only add bars to
> > > Foo if you create new bars in the Foo form .... or at least thats my
> > > take on what's happening.
>
> > > To reproduce:
>
> > > #> hobo fooBar
> > > #> cd fooBar
> > > #> ./script/generate hobo_model_resource foo name:string
> > > #> ./script/generate hobo_model_resource bar name:string
> > > #> vi app/model/foo.rb ---> add "has_many :bars, :accessible => true"
> > > #> vi app/model/bar.rb ---> add "belongs_to :foo"
> > > #> ./script/generate hobo_migration
>
> > > On Apr 29, 12:51 pm, Jeremy Savoy <[email protected]> wrote:
>
> > > > Well, the reason I was doing that is so that on my "new invitation"
> > > > and "edit invitation" pages, I have the nifty javascript <select-one>
> > > > that lets me add contacts to an invitation.
>
> > > > When I get rid of the join table but keep the "has_many :contacts,
> > > > accessible => true", when I'm on the "new invitation" screen instead
> > > > of having a <select-one> that lets me add multiple contacts one at a
> > > > time, I only have  "+" button that lets me create a new contact on the
> > > > new invitation form, which is not at all what I want (although it
> > > > would be nice as an option to select either an existing contact or
> > > > create a new one).
>
> > > > If I remove the "accessible => true" then I have nothing on the new or
> > > > edit invitation page that allows me to add contacts to it.
>
> > > > Please advise.
>
> > > > --jeremy
>
> > > > On Apr 29, 11:57 am, Matt Jones <[email protected]> wrote:
>
> > > > > On Apr 29, 2010, at 11:47 AM, Jeremy Savoy wrote:
>
> > > > > > For clarity, here is my current association situation, although its
> > > > > > not clear to me that my problem can or cannot be solved through the
> > > > > > associations.
>
> > > > > > contact model:
> > > > > >  belongs_to :invitation
>
> > > > > > invitation model:
> > > > > >  has_many :invitation_assignments, :dependent => :destroy
> > > > > >  has_many :contacts, :through => :invitation_assignments, 
> > > > > > :accessible
> > > > > > => true
>
> > > > > > invitation_assignment model (perhaps should rename this to
> > > > > > contact_assignment .... but not really relevant to the problem)
> > > > > >  belongs_to :contact
> > > > > >  belongs_to :invitation
>
> > > > > > So, is there some symbol I can use to say that each contact can 
> > > > > > belong
> > > > > > to only one invitation, perhaps a :condition? Again I apologize for
> > > > > > the newb questions but trying to pickup a language and two 
> > > > > > frameworks
> > > > > > all at once can be a bit much.
>
> > > > > If a contact can only belong to exactly one invitation, why are you  
> > > > > fooling with the join table at all? The entire *purpose* of that  
> > > > > structure is to allow many contacts to have many invitations. Change  
> > > > > the declaration in the invitation model to:
>
> > > > > has_many :contacts
>
> > > > > and ditch invitation_assigment entirely.
>
> > > > > --Matt Jones
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google 
> > > > > Groups "Hobo Users" group.
> > > > > To post to this group, send email to [email protected].
> > > > > To unsubscribe from this group, send email to 
> > > > > [email protected].
> > > > > For more options, visit this group 
> > > > > athttp://groups.google.com/group/hobousers?hl=en.
>
> > > > --
> > > > You received this message because you are subscribed to the Google 
> > > > Groups "Hobo Users" group.
> > > > To post to this group, send email to [email protected].
> > > > To unsubscribe from this group, send email to 
> > > > [email protected].
> > > > For more options, visit this group 
> > > > athttp://groups.google.com/group/hobousers?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "Hobo Users" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to 
> > > [email protected].
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/hobousers?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Hobo Users" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/hobousers?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Hobo Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/hobousers?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to