Permalink
Browse files

getting current ability as one of the parameters from the calling party

  • Loading branch information...
1 parent 9a0ec14 commit eae8d2063b92398b3b47f8a4dcaea63a76de1db0 @taasaa committed Nov 21, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/thinking_sphinx/search.rb
@@ -871,8 +871,8 @@ def instances_from_class(klass, matches)
ids = matches.collect { |match| match[:attributes]["sphinx_internal_id"] }
# filter the result set based on permissions of the current user defined in CanCan
- cancan_filtered_klass = if klass.respond_to?(:accessible_by) && options[:current_user_id]
- klass.send(:accessible_by, Ability.new(User.find(options[:current_user_id])))
+ cancan_filtered_klass = if klass.respond_to?(:accessible_by) && options[:current_ability]
+ klass.send(:accessible_by, options[:current_ability])
else
klass
end

0 comments on commit eae8d20

Please sign in to comment.