Skip to content

Instantly share code, notes, and snippets.

@dmilith
Created December 22, 2008 03:47
Show Gist options
  • Select an option

  • Save dmilith/38879 to your computer and use it in GitHub Desktop.

Select an option

Save dmilith/38879 to your computer and use it in GitHub Desktop.
class UsagePermission
include DataMapper::Resource
property :id, Serial, :index => true
property :available_subdomains_count, Integer
property :domain_id, Integer, :index => true
property :user_id, Integer, :index => true
property :created_at, DateTime
property :created_on, Date
property :updated_at, DateTime
property :updated_on, Date
belongs_to :user
belongs_to :domain
end
class Domain
include DataMapper::Resource
property :id, Serial, :index => true
property :name, String, :nullable => false, :default => "drakor.eu"
property :owner_id, Integer, :index => true, :default => 1
property :created_at, DateTime
property :created_on, Date
property :updated_at, DateTime
property :updated_on, Date
has n, :usage_permissions
has n, :users, :through => :usage_permissions, :mutable => true # workaround XXX http://datamapper.lighthouseapp.com/projects/20609/tickets/485-has-n-through-does-not-allow-saving-of-model
has n, :subdomains
belongs_to :owner, :class_name => User
end
class User
include DataMapper::Resource
has n, :usage_permissions
has n, :domains, :through => :usage_permissions, :mutable => true # workaround XXX http://datamapper.lighthouseapp.com/projects/20609/tickets/485-has-n-through-does-not-allow-saving-of-model
has n, :subdomains
has n, :ports
has n, :memory_usage_records
attr_accessor :password_confirmation
....
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment