Method: ActiveOrient::Model.autoload_object
- Defined in:
- lib/model/model.rb
.autoload_object(rid) ⇒ Object
Either retrieves the object from the rid_store or loads it from the DB.
Example:
ActiveOrient::Model.autoload_object "#00:00"
The rid_store is updated!
Todo: fetch for version in the db and load the object only if a change is detected
Note: This function is not located in ModelClass since it needs to use @@rid_store
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/model/model.rb', line 26 def self.autoload_object rid rid = rid[1..-1] if rid[0]=='#' if rid.rid? if @@rid_store[rid].present? @@rid_store[rid] # return_value else get(rid) end else logger.progname = "ActiveOrient::Model#AutoloadObject" logger.info{"#{rid} is not a valid rid."} end end |