This is a little more complicated than a normal field as the state column is 
actually from the lifecycle system.  If you want to be able to change it, 
the best way is to add a transition(s) for it.  It's a bit difficult to 
grasp when you're first starting out (unless you're already familiar with 
state machines).  Advantages to using lifecycles: you get to specify who can 
trigger transitions, you get automatic controller methods to handle them, 
you can add in post transition hooks to say send out email notices, and 
more.

Lets say you want a user to have two states, active and inactive, though it 
can be any number.

Each transition, specifies two states, a start and a final.  Additionally, 
you can specify who can access this transition, parameters to pass when 
going through it, and a code block if you need to do any complicated 
processing or want to send notices etc.

So, you might have this in your user lifecycle block:

transition :activate, { :inactive => :active }, :available_to => 
User.administrators do
  # some post transition code
end

transition :deactivate, { :active => :inactive }, :available_to => 
User.administrators do
  # some other code
end

http://cookbook.hobocentral.net/manual/lifecycles has the full description.

-- 
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.

Reply via email to