Module: MotionModel::ArrayModelAdapter
- Defined in:
- lib/motion_model/adapters/array_model_adapter.rb
Defined Under Namespace
Modules: PrivateClassMethods, PublicClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #adapter ⇒ Object
- #before_initialize(options) ⇒ Object
-
#length ⇒ Object
(also: #count)
Count of objects in the current collection.
-
#undelete ⇒ Object
Undelete does pretty much as its name implies.
Class Method Details
.included(base) ⇒ Object
7 8 9 10 11 |
# File 'lib/motion_model/adapters/array_model_adapter.rb', line 7 def self.included(base) base.extend(PrivateClassMethods) base.extend(PublicClassMethods) base.instance_variable_set("@collection", []) # Actual data end |
Instance Method Details
#adapter ⇒ Object
3 4 5 |
# File 'lib/motion_model/adapters/array_model_adapter.rb', line 3 def adapter 'Array Model Adapter' end |
#before_initialize(options) ⇒ Object
96 97 98 |
# File 'lib/motion_model/adapters/array_model_adapter.rb', line 96 def before_initialize() assign_id() end |
#length ⇒ Object Also known as: count
Count of objects in the current collection
111 112 113 |
# File 'lib/motion_model/adapters/array_model_adapter.rb', line 111 def length collection.length end |
#undelete ⇒ Object
Undelete does pretty much as its name implies. However, the natural sort order is not preserved. IMPORTANT: If you are trying to undo a cascading delete, this will not work. It only undeletes the object you still own.
105 106 107 108 |
# File 'lib/motion_model/adapters/array_model_adapter.rb', line 105 def undelete collection << self self.class.issue_notification(self, :action => 'add') end |