Did you consider extending the form tag for Assignments in application.dryml
instead of changing the form in all the pages it appears in? E.g:
<extend tag="form" for="Assignment">
<old-form merge>
<field-list: fields="assignment_type, ...">
<thing-view:>
<name-one complete-target="&@assignment" completer="thing_name"/>
</thing-view:>
</field-list:>
</old-form>
</extend>
It seems to me that would be the DRYMLiest way to do it. ;)
Andy
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of davidh
> Sent: Sunday, November 02, 2008 6:18 PM
> To: Hobo Users
> Subject: [Hobo Users] autocomplete in new-for associations
>
>
> I have an Assignment class for connecting contacts (people) and things
> through the usual has-many-through associations. Since there are many
> things and people, I customized the field-list in Assignment
> edit.dryml, new.dryml and show.dryml pages to substitute an
> autocomplete view, something like this:
>
> <edit-page>
> <form:>
> <field-list: fields=
> "assignment_type,
> ...>
> <thing-view:>
> <name-one complete-target="&@assignment"
> completer="thing_name"/>
> </contact-view:>
> </field-list:>
> </form:>
> </edit-page>
>
> In the assignment controller I have something like:
>
> autocomplete :thing_name do
> assignment = find_instance
> hobo_completions :name, Thing
> end
>
> So far so good. But I still need to get a revised field-list when
> using the New Assignment link from the thing or contact pages. (I
> have auto_actions_for things and contacts in the assignment
> controller.) So in application.dryml I add:
>
> <extend tag="new-for-contact-page" for="Assignment">
> <old-new-for-contact-page merge>
> <form:>
> <field-list: fields=
> "assignment_type,
> ...>
> <thing-view:>
> <name-one complete-target="&@assignment"
> completer="thing_name"/>
> </thing-view:>
> </field-list:>
> </form:>
> </old-new-for-contact-page>
> </extend>
>
> The page is rendered correctly, but as soon as I type something in the
> autocomplete box the styling of the page changes slightly and no
> autocomplete hints appear. In the console I see ""GET /nils/
> complete_thing_name?query=A". I figure the nil is wrong, but how to I
> correct it?
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---