Module: ActiveMongo::HasMany::ClassMethods

Included in:
Base
Defined in:
lib/active_mongo_has_many.rb

Instance Method Summary collapse

Instance Method Details

#attr_accessible(*input) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/active_mongo_has_many.rb', line 8

def attr_accessible(*input)
  @@internal_attr_accessible = []
  
  input.each do |field|
    @@internal_attr_accessible.push(field.to_sym).uniq!
  end
end

#attr_accessible_getObject



29
30
31
# File 'lib/active_mongo_has_many.rb', line 29

def attr_accessible_get
  @@internal_attr_accessible || []
end

#has_many(name, attrs = {}) ⇒ Object



4
5
6
# File 'lib/active_mongo_has_many.rb', line 4

def has_many(name, attrs = {})
  internal_has_manies_set(name, attrs)
end

#internal_has_manies_get(name) ⇒ Object



22
23
24
25
26
# File 'lib/active_mongo_has_many.rb', line 22

def internal_has_manies_get(name)
  @@internal_has_manies ||= {}
  
  @@internal_has_manies[name.to_sym]
end

#internal_has_manies_set(name, attrs) ⇒ Object



16
17
18
19
20
# File 'lib/active_mongo_has_many.rb', line 16

def internal_has_manies_set(name, attrs)
  @@internal_has_manies ||= {}
  
  @@internal_has_manies[name.to_sym] = attrs if @@internal_has_manies[name].nil?
end