-
Notifications
You must be signed in to change notification settings - Fork 806
Closed
Labels
Description
I am using cancancan for authorizations in my rails app. In this code, the ES query returns some records that I already now I am allowed to visualize. I was scratching my head because cancancan always returned false when running the can? method.
records = Elasticsearch::Model.search(query, models).records.records records = records.select{|r| can?(:show, r)}
Then I noticed that if I have a model 'Test' and run records.first.class == Test
it returns false!
I think this is the issue that is causing cancancan to always return false
ability.rb
can [:show] Test
I called .to_s.constantize in Elasticsearch::Model::Adapter::Multiple::Records__type_for_hit and fixed it.
Does anyone think this can be considered a bug?
SeanLF