Patrick Sullivan wrote: > As State Machine plugin. All you need is the plugin and a "state" > (varchar) > column in the model's database table. This gives you all kinds of neat > functionality. >
Thank you immensely for bring that plugin to my attention. As for the child naming, I'm using pseudo code for the most part. Sorry about that. I just have a (silly) question about the event! calls... where do I put them? :) I tried searching for it but didn't find an exact answer. I was able to make the state column into a drop box with the three states like so (in a hurry): [code] <%= select :child, :state, { "Safe" => "safe", "Lost" => "lost", "Found" => "found"} %> [/code] So it updates and displays the state just fine (@child.state). HOWEVER, I'm sure the use of @child.lost!, @child.found!, and @child.safe! is there for a reason. What is the best way to go about implementing this? >From just some quick brainstorming I'm thinking the below if block in the update (and create) method would work, but perhaps there is a better way? [code] def update @child = Children.find(params[:id]) if params[:state]=='lost' @child.lost! elsif params[:state]=='found' @child.found! else @child.safe! end ... end [/code] Also, is it possible to use more than one act_as_state_machine per model? I'm assuming you can by assigning a :column => 'column_name'. But confirmation would be nice. Thank you so much again!!! -Tony -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---