Sha256: 4dcaa4825ef6b9d1740f5e6951c0db6a89597ad868f758ccc06044f2c3e89ac2
Contents?: true
Size: 1.55 KB
Versions: 2
Compression:
Stored size: 1.55 KB
Contents
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 module RTM::AR class Association < Reifiable include RTM::Association wrapper_cache parent :topic_map property :type, :aka => [:ty,:t], :rw => true, :type => :Topic, :wrap => true property_set :scope, :type => :Topic, :wrap => true, :add => :scope, :remove => :scope alias :add_theme :add_scope alias :remove_theme :remove_scope property_set :roles, :aka => [:r, :association_roles], :type => :Role, :wrap => true, :create => :role, :create_aka => [:cr, :create_association_role], :create_args => [ {:name => :type, :type => :Topic}, {:name => :player, :type => :Topic}] property_set :players, :aka => [:role_players, :rp, :pl], :type => :Topic, :wrap => true property_set :types, :aka => [:role_types, :rt], :type => :Topic, :wrap => true def id __getobj__.id end equality [:scope, :type, :roles] def filter_roles(*args) if args.size == 1 t = topic_map.get(args.first) return self.roles.find(:all,:conditions => ["ttype_id = ?", t.id]) end false end end class Role < Reifiable include RTM::Role wrapper_cache parent :association property :player, :aka => [:pl,:topic], :rw => true, :type => :Topic, :wrap => true property :type, :aka => [:ty,:t], :rw => true, :type => :Topic, :wrap => true def id __getobj__.id end equality [:type, :player, :parent] end AssociationRole = Role end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rtm-activerecord-0.2.1 | lib/rtm/activerecord/association_and_role.rb |
rtm-activerecord-0.2.0 | lib/rtm/activerecord/association_and_role.rb |