I'm posting this as a reference for other users, and will submit a pull 
request for the docs. 

I've discovered that if you have repeated transitions in a lifecycle, the 
FIRST variation of a specific transition dictates whether *params* will be 
available for subsequent versions of the *same* transition. 

For example: Given these two variations of a transition (available to 
different users), the [:comments] param on the second variation is actually 
NOT available to the transition. 

    transition :reject, {:submitted => :rejected},  
      :available_to => 'acting_user if (acting_user.administrator? || 
acting_user.officer?)' do 

    transition :reject, {:in_review => :rejected}, :params => [:comments], 
      :available_to => 'acting_user if (acting_user.administrator?)' do 

For the second variation to support the param, it needs to be listed first 
in the lifecycle, as follows:

    transition :reject, {:in_review => :rejected}, :params => [:comments], 
      :available_to => 'acting_user if (acting_user.administrator?)' do 

    transition :reject, {:submitted => :rejected},  
      :available_to => 'acting_user if (acting_user.administrator? || 
acting_user.officer?)' do 

In my case, I was depending on the :comments field to appear within a form 
as follows:

      <call-tag tag="#{transition}-form">
        <field-list:>
          <comments-view:>
            <text-area class="no-ckeditor"/>
          </comments-view:>
        </field-list:>
        <actions: replace></actions:>
      </call-tag>

but it will only appear if it's listed on the first variation. 


Alternatively, if these two variations of the transition were made 
available to the same users, their ":from" transitions could be combined in 
an array:

    transition :reject, { [:submitted, :in_review] => :rejected}, :params 
=> [:comments], 
      :available_to => 'acting_user if (acting_user.administrator? || 
acting_user.officer?)' do 


A subtle anomaly that tripped me up briefly.

Tim


Tim

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to