On May 26, 11:56 am, Matt Jones <[email protected]> wrote:

> True - you appear to have found a missing feature. :)
>
> I can see a definite use case for adding the ability to have creator
> actions defined on a parent object - could you open a ticket on
> Lighthouse so nobody forgets?
>
> Thanks,
>
> --Matt Jones

Will do.

In the meantime, I have nutted out a work around:

1. Create a route that maps the malformed URL to the appropriate
controller

 map.register_survey_for_site '/sites/:site_id/register', :controller
=> 'surveys', :action => 'register'

2. Modify the register action in the controller to extract the parent
id

  def register
    @site = Site.find(params[:site_id])
    creator_page_action :register
  end

3. Modify the register page to include the parent id as a hidden field

    <input type="hidden" name="survey[site_id]" value="#[email protected]}"/>

>From then on everything falls into the normal lifecycle.

Once you get your head around it, Hobo lifecycles are pretty neat -
certainly saves a lot of coding.  There are a couple of traps though;
don't label your transitions :update (an obviously conflict with Rest
that had me stumped for hours) or :edit (fool me once....)

I have knocked up a working example that I'll write up as a recipe
shortly.

Dean

-- 
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.

Reply via email to