Hi,
Sorry to double-post, but I also piggybacked on this other recent
lifecycle question, here:
http://groups.google.com/group/hobousers/browse_thread/thread/7fc6dd46e51d3cc5
I could really use the help so I wanted to give this its own subject
and get a bit more visibility. Please forgive...
PROBLEM
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.
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 am able to obtain a form page for each of the lifecycle
steps, such as :give_date---where, upon entering
http://localhost:3000/deliveries/6/give_date, I get a page titled
"Give date" with a submit button labeled "Give date"---the form page
itself is blank.
I was expecting to receive a form page for each step comprised of the
fields defined in :params for each transition.
So, using the above step, :give_date, as such:
transition :give_date,
{ :given_items => :given_date },
:params => [ :date ],
:available_to => :all do
end
I would expect to see a form page entitled "Give date," with one form
field, Date, and a submit button labeled "Give date."
But the Date field is missing.
BTW, submission of the (empty) form page _does_ transition the model
properly to its new state.
Can anyone help me with these two issues?
Is the lifecycle code fully cooked in the controller and view layers,
btw? Or do I need to add some code to my controllers?
TIA,
James