neo4jrb / activegraph

An active model wrapper for the Neo4j Graph Database for Ruby.
http://neo4jrb.io
MIT License
1.4k stars 276 forks source link

default_scope #807

Open subvertallchris opened 9 years ago

subvertallchris commented 9 years ago

A request from a friend at work.

It'd be nice to be able to set a default scope in models like you can in ActiveRecord. http://api.rubyonrails.org/classes/ActiveRecord/Scoping/Default/ClassMethods.html#method-i-default_scope

cheerfulstoic commented 9 years ago

Definitely would be great! One thing to caution (perhaps in the docs) is that people should be very careful about how they use this. In a previous job somebody put a bunch of eager loads into the default_scope of a model to speed up some pages, but then we were loading unnecessary data on a lot of other pages.

cheerfulstoic commented 8 years ago

Was looking into another issue and realizing that we need unscoped both for this but also so that we can refer to all nodes within a class method / scope