Trying a new, simpler approach to try to get my app working -- have to
complete v1.0 asap, or cancel the project. To dodge my formlet
troubles, I created a new show_action to add and delete
ProjectCustodian (join table) associations, including:
1. a form with custodian name autocompleter and submit button
2. a table-plus, wrapped in a part, showing total number and list of
custodians
Almost everything works. But when add update="my-foo-part" to submit
(to get the table and total to update) or update="total-custodians" to
delete-button (just to update the count) I get a nasty pop-up dialog
showing a bunch of html and an error message.
My only thought is maybe I need to update @project_custodians somehow?
Here's the controller code:
show_action :editcustodians do
@project = find_instance
order = parse_sort_param("custodian.name", "custodian.type",
"custodian.last_name")
@project_custodians =
@project.project_custodians.custodian_names_like(params
[:search]).sort_custodians_by(order)
this.attributes = params[:project] || {}
hobo_ajax_response if request.xhr?
end
And the dryml:
<show-page>
<collection: replace>
<form with="&ProjectCustodian.new" reset-form refocus-form
update="my-foo-part">
<% this.project_id = @project.id -%>
<name-one:custodian complete-target="&@project"
completer="new_custodian_name" />
<submit label="Add Custodian" />
</form>
<div part="my-foo-part">
<table-plus with="&@project_custodians" fields="custodian.name,
custodian.custodian_type, custodian.last_name">
<prepend-header:>
<div part="total-custodians">
<p class="subform-count">There <count prefix="are"/><%= "
matching *#{params[:search]}*" unless params[:search].blank? %> </p>
</div>
</prepend-header:>
<empty-message:>No custodians have been added to this
project.</empty-message:>
<controls:>
<delete-button class="ui-icon ui-icon-circle-close"
update="total-custodians"/>
</controls:>
</table-plus>
</div>
</collection:>
</show-page>
And the error from the log after hitting delete:
NoMethodError (You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.split):
vendor/plugins/hobo/hobo/lib/hobo/dryml/part_context.rb:112:in
`parse_this_id'
vendor/plugins/hobo/hobo/lib/hobo/dryml/part_context.rb:90:in
`unmarshal'
vendor/plugins/hobo/hobo/lib/hobo/dryml/part_context.rb:49:in
`for_refresh'
vendor/plugins/hobo/hobo/lib/hobo/dryml/part_context.rb:55:in
`initialize'
vendor/plugins/hobo/hobo/lib/hobo/dryml/part_context.rb:48:in `new'
vendor/plugins/hobo/hobo/lib/hobo/dryml/part_context.rb:48:in
`for_refresh'
vendor/plugins/hobo/hobo/lib/hobo/dryml/template_environment.rb:
166:in `refresh_part'
vendor/plugins/hobo/hobo/lib/hobo/controller.rb:90:in
`ajax_update_response'
vendor/plugins/hobo/hobo/lib/hobo/controller.rb:85:in `each'
vendor/plugins/hobo/hobo/lib/hobo/controller.rb:85:in
`ajax_update_response'
vendor/plugins/hobo/hobo/lib/hobo/model_controller.rb:758:in
`render'
vendor/plugins/hobo/hobo/lib/hobo/controller.rb:83:in
`ajax_update_response'
vendor/plugins/hobo/hobo/lib/hobo/controller.rb:71:in
`hobo_ajax_response'
vendor/plugins/hobo/hobo/lib/hobo/model_controller.rb:613:in
`destroy_response'
vendor/plugins/hobo/hobo/lib/hobo/model_controller.rb:611:in
`destroy_response'
vendor/plugins/hobo/hobo/lib/hobo/model_controller.rb:605:in
`hobo_destroy'
vendor/plugins/hobo/hobo/lib/hobo/model_controller.rb:157:in
`destroy'
vendor/plugins/hobo/hobo/lib/hobo/controller.rb:22:in `call'
vendor/plugins/hobo/hobo/lib/hobo/controller.rb:22:in
`included_in_class'
Rendered rescues/_trace (240.0ms)
Rendered rescues/_request_and_response (5.0ms)
Rendering rescues/layout (internal_server_error)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---