Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scope_for_authentication method to find records #727

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hubertlepicki
Copy link
Contributor

So I was trying to do exactly as this guy over here #723

I figured I need a scope, and I do not like the default_scope solution.

This commit uses scope_for_authentication method, if defined on given class, to find the record in question. In my case, this is implemented as where("deleted_at is not null") but I guess there are other use cases or conditions that you might want to apply in similar manner.

Please have a loook, and if you find it useful merge. If no, no harm done, I'll keep my fork for this single app for time being until I find better solution.

@ivanreese
Copy link

This looks like it'd solve an issue I'm experiencing as well — I'd like to add some includes() to the query that finds the current_user. Having a scope dedicated to Sorcery seems like it'd allow me to do this.

@ivanreese ivanreese mentioned this pull request Jan 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants