Module: Ecoportal::API::Common::Content::CollectionModel::Doc::RootedKey::InstanceMethods
- Defined in:
- lib/ecoportal/api/common/content/collection_model/doc/rooted_key.rb
Instance Method Summary collapse
-
#_rooted_doc_key(value) ⇒ Object
(also: #_doc_pos)
Transforms
valueinto the actualkeyto access the object in the docArray.
Instance Method Details
#_rooted_doc_key(value) ⇒ Object Also known as: _doc_pos
Note:
- The name of the method is after the paren't class method
- This method would have been better called
_doc_pos:)
Note:
this method shouldn't be protected nor private. See DoubleModel#_rooted_doc_key
Transforms value into the actual key to access the object in the doc Array
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ecoportal/api/common/content/collection_model/doc/rooted_key.rb', line 27 def _rooted_doc_key(value) #print "*(#{value.class})" return super unless fetchable_position?(value) if (id = get_key(value)) # fetch position _doc_items.index {|item| get_key(item) == id} else show_str = cant_find_child_explanation(value) raise UnlinkedModel, "Can't find child: #{show_str}" end end |