So you've got 4 states.  One for each of the combinations though
transitions becomes a little more cumbersome as you'll need twice as
many.

On Mar 5, 7:35 am, atmorell <[email protected]> wrote:
> I don't want the message to be deleted for the author if the recipient
> has deleted the message. Thought about creating two fields
> author_deleted and resipient_deleted in the message model. Hmmm what
> would be the best way of updating a single attribute from a link -
> "delete link that set's a column to true"? Should I create a custom
> action e.g author_delete in my controller etc? Or is there a smarter
> hobo way of doing such a task?
>
> On Mar 5, 3:06 pm, Bryan Larsen <[email protected]> wrote:
>
> > 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