Sha256: 6faefaa8da638da5694675dbe20218640a2d5fb32bfb386a2fb4f5f2aae810f3

Contents?: true

Size: 402 Bytes

Versions: 1

Compression:

Stored size: 402 Bytes

Contents

class GuardWithParams
  include AASM
  aasm do
    state :new, :reviewed, :finalized

    event :mark_as_reviewed do
      transitions :from => :new, :to => :reviewed, :guards => [:user_is_manager?]
    end
  end

  def user_is_manager?(user)
    ok = false
    if user.has_role? :manager
      ok = true
    end
    return ok
  end
end

class GuardParamsClass
  def has_role?(role)
    true
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aasm-4.11.1 spec/models/guard_with_params.rb