HI,
I have the same requirement.
I am trying to use a Hobo Lifecycle to define a multi-step wizard,
which steps a user through the creation of a Delivery.
The user is asked a series of questions, whose input builds up the
single model, Delivery. The wizard does not cross models, or use more
than one model.
The requirement also matches Tom's recommendation below, that the
intermediate steps makes sense as proper steps.
I have defined the lifecycle as follows:
--------------
lifecycle do
state :begun, :given_date, :given_time_of_day, :given_fromzip,
:given_tozip, :given_service_level, :given_building_info, :requested
create :begin,
:params => [ :customer ],
:become => :begun,
:available_to => "User",
:user_becomes => :customer
transition :give_items,
{ :begun => :given_items },
:params => [ :delivery_items ],
:available_to => :all do
end
transition :give_date,
{ :given_items => :given_date },
:params => [ :date ],
:available_to => :all do
end
transition :give_time_of_day,
{ :given_date => :given_time_of_day },
:params => [ :time_of_day ],
:available_to => :all do
end
transition :give_fromzip,
{ :given_time_of_day => :given_fromzip },
:params => [ :from_zip ],
:available_to => :all do
end
transition :give_tozip,
{ :given_fromzip => :given_tozip },
:params => [ :to_zip ],
:available_to => :all do
end
transition :give_service_level,
{ :given_tozip => :given_service_level },
:params => [ :service_level ],
:available_to => :all do
end
transition :give_building_info,
{ :given_service_level => :given_building_info },
:params => [ :building_flights, :building_elevator ],
:available_to => :all do
end
end
-------
I am experiencing two issues with this approach:
1) When I use any value for :available_to besides :all, for
instance :customer, I get an error of Undefined Method
"customer_is?" (I have set the permissions properly, I believe)
2) While I can obtain a page for any of the lifecycle steps, such
as :give_date--where I get a page titled "Give date" with a button
labeled "Give date"--the page itself, which should be a form with
fields for each field indicated in :params => [ :field1, :field2,
etc ], is blank. In other words, no fields.
Submission of the form does transition the model properly though.
Can anyone help me with these two issues? Is the lifecycle code fully
cooked?
TIA,
James
On Feb 15, 6:41 am, Tom Locke <[email protected]> wrote:
> > I need to step a user through a sequence of forms, like a "wizard". I
> > am considering the rails ActsAsWizard pluging or using Hobo
> > lifecycles.
>
> I wouldn't use lifecycles unless the intermediate states make sense as
> proper states that the model could stay in for a while.
>
> Tom
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---