Sha256: b9a61ee73977dc0f19ee889f87b80fa040becc259ffb02a79fafc617fa36d94e

Contents?: true

Size: 411 Bytes

Versions: 18

Compression:

Stored size: 411 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 && user.has_role?(:manager)
      ok = true
    end
    return ok
  end
end

class GuardParamsClass
  def has_role?(role)
    true
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
aasm-5.3.1 spec/models/guard_with_params.rb
aasm-5.3.0 spec/models/guard_with_params.rb
aasm-5.2.0 spec/models/guard_with_params.rb
aasm-5.1.1 spec/models/guard_with_params.rb
aasm-5.1.0 spec/models/guard_with_params.rb
aasm-5.0.8 spec/models/guard_with_params.rb
aasm-5.0.7 spec/models/guard_with_params.rb
aasm-5.0.6 spec/models/guard_with_params.rb
aasm-5.0.5 spec/models/guard_with_params.rb
aasm-5.0.4 spec/models/guard_with_params.rb
aasm-5.0.3 spec/models/guard_with_params.rb
aasm-5.0.2 spec/models/guard_with_params.rb
aasm-5.0.1 spec/models/guard_with_params.rb
aasm-5.0.0 spec/models/guard_with_params.rb
aasm-4.12.3 spec/models/guard_with_params.rb
aasm-4.12.2 spec/models/guard_with_params.rb
aasm-4.12.1 spec/models/guard_with_params.rb
aasm-4.12.0 spec/models/guard_with_params.rb