class Feature
  include DataMapper::Resource

  belongs_to :license
  belongs_to :slot

  has n, :runtime_features

  property :id, Serial
  property :max_user, Integer
  property :valid_till, DateTime

  timestamps :at

  def name
    slot.name
  end

  def self.avail_slots
    Slot.editable
  end

  def self.restricted
    all(:max_user.gt => 0, :max_user.gt =>
Feature.runtime_features.count())
  end
end

The restricted method if Feature should only return the Features that
have not exceeded its max_user count.

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" 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/datamapper?hl=en.

Reply via email to