I want to use autocompletion to select one or more authors:
<input-many:favorite_authors>
<name-one complete-target="&@user" completer="new_favorite_author"/>
</input-many:favorite_authors>
However, the name-one dies when a form for a new model is being displayed:
ActionView::TemplateError (You have a nil object when you didn't expect it!
The error occurred while evaluating nil.dasherize) on line #65 of
app/views/users/welcome.dryml:
The crash is in the name-one tag:
class="autocompleter #{type_and_field.dasherize}"
When the form is first being rendered, the collection is empty so Hobo
creates a fake-field-context. type_and_field returns nil for the
fake-field-context (an array doesn't respond to :typed_id), we end up
calling nil.dasherize, and Ruby bombs out.
This patch appears to fix the problem...
diff --git a/vendor/plugins/hobo/hobo/taglibs/rapid_forms.dryml
b/vendor/plugins/hobo/hobo/taglibs/rapid_forms.dryml
index 60f1cdc..66d7701 100644
--- a/vendor/plugins/hobo/hobo/taglibs/rapid_forms.dryml
+++ b/vendor/plugins/hobo/hobo/taglibs/rapid_forms.dryml
@@ -643,7 +643,7 @@ The completions are provided by the server with a
GET request. The `complete-tar
completer ||= (complete_target.is_a?(Class) ? complete_target :
complete_target.class).name_attribute
-%>
<input type="text" name="#{param_name_for_this}"
- class="autocompleter #{type_and_field.dasherize} #{css_data
:complete_on, typed_id(complete_target), completer}
+ class="autocompleter #{type_and_field._?.dasherize}
#{css_data :complete_on, typed_id(complete_target), complet
value="&name :no_wrapper => true, :if_present => true"
merge-attrs/>
<div class="completions-popup" style="display:none"></div>
Is this the proper fix, or is something more insidious going on?
- Scott
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---