You can't have more than one Lifecycle in a model, unfortunately. The need for more than one Lifecycle in a model should be minimal, and you can always create a child model to hold the second Lifecycle.

However, in your case, there's a much simpler answer. :available_to can contain a Proc or expression that returns a collection, so it might be as simple as :available_to => "authors + recipients"

http://cookbook.hobocentral.net/manual/lifecycles#the__option

Bryan


atmorell wrote:
Hello,

I have message model where a recipient or author can delete a message.
Is it possible to control this logic with lifecycles? If I add a
second lifecycle to my model hobe gives me an error:

script/generate hobo_migration
Invalid field type: nil for Message.recipient_deleted

  lifecycle(:state_field => "author_deleted") do
    state :false, :true
    transition :delete, { :false => :true }, :available_to => :author
    transition :undelete, { :true => :false }, :available_to
=> :author
  end

  lifecycle(:state_field => "recipient_deleted") do
    state :false, :true
    transition :delete, { :false => :true }, :available_to
=> :recipient
    transition :undelete, { :true => :false }, :available_to
=> :recipient
  end


Best regards.
Asbjørn Morell.


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