If it's going to be code it needs to be a proc.

something like

available_to_debug_user = Proc.new do |r|
  if (acting_user.is_a?(User) and acting_user.debugmode)
    acting_user
  else
    nil
  end
end

available_to => available_to_debug_user

If you look at the hobo cookbook manual it has a nice section on
available_to in lifecycles that explains it. I have not tested it this
way though...

Brett




On May 6, 10:00 am, Karsten Redmer <[email protected]> wrote:
> Hi,
>
> I want to have a condition for my transition if debugmode is set for
> the (acting-user in order to display the transition-button or not -
> and even to restrict access to it)
>
> When I  take available_to "User" I can see the transition button. When
> I try  "User if User.debugmode" I don't see it. Acting_user don't
> work, too.
>
> How can I solve this ?
>
> ( I tried several things, but nothing worked well)
>
> Thanks,
> Karsten
>
> my Contact-Transition:
>
> transition :chooseuplineback, { :ready
> => :missingUpline }, :available_to => "User if User.debugmode"
>
> my user-model:
>
> class User < ActiveRecord::Base
>
>   hobo_user_model # Don't put anything above this
>
>   fields do
>     email_address :email_address, :unique, :name => true, :login =>
> true
>     administrator :boolean, :default => false
>     firstname  :string
>     lastname    :string
>     debugmode :boolean, :default => false
>     timestamps
>   end
>   has_many :successes
>   has_many :contacts, :class_name => "Contact", :through => :successes
>
> ++++++++++++
>
> my contact-model:
>
> class Contact < ActiveRecord::Base
>
>   hobo_model # Don't put anything above this
>
>   fields do
>     companyname :string
>     lastname  :string
>     firstname :string
>     email :email_address, :required
>    ...
>   end
>
>   has_many :successes
>   has_many :users, :class_name => "User", :through => :successes
>
> --
> 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 
> athttp://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