I jumped into the Hobo codebase again and found that when rendering the
transition button, it loops over the available_transitions and verifies each
with can_run?.  It eventually breaks when it calls guard_ok? as the if fails
at this point.  In an ideal world should I be checking this myself before
trying to put a transition-button on the page?  Or is this an oversight by
hobo?

On Fri, May 28, 2010 at 11:10 AM, Chris Apolzon <[email protected]> wrote:

> I've run into another snag in my lifecycle code.  I tried to add
> an :if check to a transition as so:
>    transition :complete, { :reviewing => :completed },
>    :if => "manuscript_assignments.count < 2",
>    :available_to => "User"
>
> Which works fine, except for when the :if check fails.  (I also tried
> using a Proc and/or :unless, same result).  When the :if check fails
> and I try to display a transition-button with:
> <transition-button transition="complete" if="&this.state=='reviewing'"
> label="Accept"/>
>
> I get an undefined method 'name' for nilClass error.  Additionally, if
> I put a debugger line in the :if check, that code is executed when I
> load a page with the transition button.  I would have thought that
> check is only fired when you actually try to transition, not when you
> render the transition button.
>
> I'm sure I'm just missing something as it seems like doing a
> precondition check on a transition would be a fairly common use case.
>
> Thanks!
>
> --
> 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]<hobousers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=en.
>
>

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