You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
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?
The text was updated successfully, but these errors were encountered: