it looks like you tried to post this question to the Hobo Users mailing list -- I got a moderation message, but it doesn't appear that your post got posted, nor can I find it to let it through. Please try reposting it, there are several helpful people on the list that don't monitor the Hobo tag here.
In Hobo 1.3, the new action doesn't support part AJAX, so there really isn't much magic. You can just replace the action with your own:
def new_for_page
@activity = Activity.find(...)
@page = Page.find(params[:page_id])
@widget = @page.widgets.new
end
There is a little bit of magic referenced above: if you're in WidgetsController, assigning to @widget will also assign to this
.
But as you said, the knowledge is obviously in there somewhere, and your custom controller action shouldn't be necessary.
This statement seems wrong: However, for a new Widget, this fails messily, because either &this or &this.page is not yet set.
It looks like you're properly using owner actions. /pages/:page_id/widgets/new
is the route. In widgets_controller it's the new_for_page
action. In a new or new_for action, this
is set to an unsaved version of the object. In your action, it should have been created with the equivalent of Page.find(params[:page]).widgets.new
. In other words, both this
and this.page
should be populated.
I'm sure you didn't make your statement up out of thin air, so there's probably something else going on.