ncbo / goo

Graph Oriented Objects (GOO) for Ruby. A RDF/SPARQL based ORM.
http://ncbo.github.io/goo/
Other
15 stars 6 forks source link

Find should NOT preload attributes #53

Closed msalvadores closed 5 years ago

msalvadores commented 11 years ago

For consistency with where and all and to avoid confusion and improve performance. Find might be use to see if a resource exists.

msalvadores commented 11 years ago

Correct usage for find from now:

instance = Model.find("boo") 
instance.load unless instance.loaded?
puts instance.attr

the returned instance is not loaded. It is just a reference. To access the attributes one should do instance.load to be safe we can always check the loaded? flag.

Notice that find returns nil when the object cannot does not exist. This behavior was like this in previous versions.

msalvadores commented 11 years ago

Changed to load attributes on find by default and an option to opt out.

Eventually find will not load the attributes and they will loaded on demand (see #62)

graybeal commented 5 years ago

This is either resolved, or no longer needed.