Hi all;
Just passing along some information conveyed to me by Bryan Larsen.
In my controller, I had overridden an #edit action as follows:
def edit
@document = Document.find_by_id(params[:id])
...
end
The trouble with this method of loading the object being edited (the
document) is that it's not setting a critical, internal Hobo variable named
"this". The consequence of this was that my edit.dryml page's use of the
<delete-button> tag was creating an ajaxified "in-place" version of the
button instead of the usual button that would take me off the page. I would
click the Delete button to delete the record being edited and expected to be
redirected to the model's index page (as would be the automatic action after
the delete), but after deleting the object, my browser just sat there not
knowing what to do next, entertaining me with the "Removing" spinner.
It turns out that Hobo's internal code for the <delete-button> tag includes
the following line:
in_place = false if in_place.nil? && this == @this &&
request.method.downcase == "get"
In my case, the "this == @this" comparison was failing because there had
been no assignment to @this.
So, my #edit override really needed to make this assignment instead:
self.this = Document.find_by_id(params[:id])
The assignment to self.this also magically looks after setting @document
needed by the view.
And, bingo, I get the normal <delete-button> that properly moves me off the
page as I'd hoped.
Thanks, Bryan.
Tim
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/hobousers/-/iokZ2IHbVhUJ.
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.