Answering my own question here, in case it helps someone else out there working on Lifecycles. (Brilliant, btw.)
(2) The reason the relevant form fields were not showing is due to a syntax error, not corrected in current documentation. I found the correct syntax in this wiki, created by another user (thank you!): http://wiki.github.com/tablatom/hobo/lifecycles So, in your transition steps, instead of declaring your fields in an array called :params, the array is called :update. So, instead of: transition :give_date, { :given_items => :given_date }, :params => [ :date ], :available_to => :all do end It should be: transition :give_date, { :given_items => :given_date }, :update => [ :date ], :available_to => :all do end That solved my problem (2). Still working on (1). -james On Feb 16, 9:03 pm, afinetooth <[email protected]> wrote: > Hi, > > Sorry to double-post, but I also piggybacked on this other > recentlifecyclequestion, > here:http://groups.google.com/group/hobousers/browse_thread/thread/7fc6dd4... > > 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 HoboLifecycleto 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 thelifecycleas follows: > > --------------lifecycledo > > 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 thelifecycle > steps, such as :give_date---where, upon > enteringhttp://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 eachtransition. > > 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_transitionthe model > properly to its new state. > > Can anyone help me with these two issues? > > Is thelifecyclecode fully cooked in the controller and view layers, > btw? Or do I need to add some code to my controllers? > > TIA, > James --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
