Module: MongoMapper::Plugins::SpaceKeys::ClassMethods
- Defined in:
- lib/rad/mongo_mapper/space_keys.rb
Instance Method Summary collapse
Instance Method Details
#define_space_keys_containers ⇒ Object
53 54 55 56 57 |
# File 'lib/rad/mongo_mapper/space_keys.rb', line 53 def define_space_keys_containers unless associations.keys.include? 'space_keys_containers' has_many :space_keys_containers, :class_name => 'MongoMapper::Plugins::SpaceKeys::SpaceKeysContainer', :protected => true end end |
#space_key(key, type, options = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rad/mongo_mapper/space_keys.rb', line 34 def space_key key, type, = {} define_space_keys_containers SpaceKeysContainer.send :key, key, type, define_method key do get_create_or_delete_space_keys_container false do |container| container.send key end end define_method "#{key}=" do |value| get_create_or_delete_space_keys_container true do |container| container.send "#{key}=", value value end end end |