June 2013 Meeting
The June 2013 meeting of LRUG will be on Monday the 10th of June, from 6:30pm to 8:00pm. Our hosts Skills Matter will be providing the space, at their offices on Goswell Road; The Skills Matter eXchange. Registration details are given below.
State Transitions Are People Too
JB Steadman says:
In this talk I present a simple ActiveRecord-based alternative to the many popular state machine gems.
Suppose you're dealing with a school application system. Applications can be submitted, rejected, approved. Then you would have
class Submission < StateTransition end
and so on. StateTransition is an STI subclass of ActiveRecord::Base.
Inside each 'concrete' transition subclass, AR validations determine whether the transition can be created, given current system state. Callbacks make changes to other models that result from the transitions, as well as trigger other effects like emails.
This shifts emphasis from the models to the transitions themselves. Model classes don't get cluttered with logic related to multiple transitions - that logic lives in the transition classes. It works nicely with REST. You are literally creating an Approval, rather than "approving". Logging of transitions is front and center. Nobody has to learn a new lib and you're never beholden to yesteryear's state machine gem-of-the-month.
Application Example based on Gov.uk public code
Jairo Diaz says:
We'll finish the formal talk-based part of the meeting at about 8pm and start the informal pub-based part about 5 minutes later in The Slaughtered Lamb. If you can't make the talks, do come along just for the pub, someone can get you caught up on what happened and no-one will know you weren't there!
Also, the nice folks at Yammer are putting some money behind the bar to provide some drinks for us, so there are even more reasons to make it along!
To secure a place at the meeting you must register with our hosts Skills Matter. It helps to make sure we have the room laid out with enough chairs, and in extreme cases that we get priority on the larger rooms over other groups using the space on the same night. Also, it's polite (don't forget MINASWAN), so please do register with Skills Matter.
You can also follow this meeting on lanyrd, but this is not a meaningful way to tell Skills Matter you wish to attend. It's just for the lols, innit?
Posted by Murray Steele on May 25, 2013