Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

load_collection? triggers sql query on inherited resources #813

Open
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+5 −1
Split
@@ -74,7 +74,11 @@ def load_instance?
end
def load_collection?
- resource_base.respond_to?(:accessible_by) && !current_ability.has_block?(authorization_action, resource_class)
+ if @options[:through]
@matt-glover

matt-glover Mar 28, 2013

Does this need to be something like: if @options[:through] && parent_resource instead to avoid raising when resource_base resolves to the resource_class when @options[:shallow] is true?

+ resource_base.proxy_association.klass
+ else
+ resource_base
+ end.respond_to?(:accessible_by) && !current_ability.has_block?(authorization_action, resource_class)
end
def load_collection