#730 open
dsc68

auto_actions_for :lifecycle

Reported by dsc68 | May 26th, 2010 @ 08:32 AM | in Hobo 1.4

"auto_actions :lifecycle" exists but the corresponding "owner" action "auto_actions_for ... :lifecycle" is missing. This make it difficult to create owned records that have a lifecycle.

The use case I have is a number of sites, each of which have a number of surveys. Each survey has a lifecycle of in_progress, submitted, accepted or rejected.

A workaround is:

1: Create a link on the parent show page to the creator action

<a:surveys action="register">Register a new survey</a>

Note: the resulting URL is malformed.

2: 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'

3: 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

4: Modify the register page to include the parent id as a hidden field

    <input type="hidden" name="survey[site_id]" value="#{@site.id}"/>

From then on everything falls into the normal lifecycle.

Comments and changes to this ticket

  • Matt Jones

    Matt Jones September 14th, 2011 @ 10:34 PM

    • State changed from “new” to “open”
    • Milestone set to Hobo 1.4
    • Milestone order changed from “0” to “0”

    This isn't currently supported, but sounds like a useful feature.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Pages