the available_to parameter isn't the easiest to understand at first look...
here's pieces of a similar functionality lifecycle that I made:
named_scope :administrators, :conditions => { :administrator => true }
transition :ban, { [:verified, :unverified, :active, :inactive] =>
:banned },
:available_to => User.administrators do
UserMailer.deliver_email(self,"Account Banned","Due to violations,
your account has been banned.")
end
available_to expects one of these: :key_holder, :all, or a symbol of a
method, string or proc that returns a Class, collection or record.
http://cookbook.hobocentral.net/manual/lifecycles#the__option
the first two are pretty straightforward, the rest are compared against the
acting_user. Class if acting_user is a kind of that class; collection if it
includes the acting_user; record if record is the acting_user.
So, with that in mind I made an easy way to get a collection of
administrators for the comparison.
--
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.