Module: OceanDynamo::HasMany
- Included in:
- Table
- Defined in:
- lib/ocean-dynamo/associations/has_many.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#reload ⇒ Object
Sets all has_many relations to nil.
Class Method Details
.included(base) ⇒ Object
4 5 6 |
# File 'lib/ocean-dynamo/associations/has_many.rb', line 4 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#reload ⇒ Object
Sets all has_many relations to nil.
100 101 102 103 104 105 106 107 108 109 |
# File 'lib/ocean-dynamo/associations/has_many.rb', line 100 def reload(*) result = super self.class.relations_of_type(:has_many).each do |klass| attr_name = klass.to_s.pluralize.underscore instance_variable_set("@#{attr_name}", nil) end result end |