markbates / mongoid-tags-arent-hard

A tagging gem for Mongoid 3 that doesn't actually suck.
MIT License
16 stars 12 forks source link

Fixed class method all_#{name} to honor default scope #11

Closed davesouth closed 11 years ago

davesouth commented 11 years ago

Class method all_#{name} failed to apply default_scope. The fix is simple. Instead of calling "queryable", we use "all" which creates the valid Mongoid query object that includes the default scope. If we want to skip the default scope we add "unscoped" like this: Class.unscoped.all_tags

Default scope is often used to enforce account scope on multi-tenant projects. Without default scope being honored, the all_#{name} method returns all items found across tenants.

markbates commented 11 years ago

Thanks. Released in version 1.1.4