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

Deprecate authenticates_many #627

Merged
merged 1 commit into from
Sep 21, 2018
Merged

Deprecate authenticates_many #627

merged 1 commit into from
Sep 21, 2018

Conversation

jaredbeck
Copy link
Collaborator

In early 2017, when we discussed our "wishlists", Ben mentioned that
he would like to drop authenticates_many. At that time, I was using
it at work, but I am not using it any longer.

It's a useful feature, but I'd like to see Authlogic "core" do less.

As the message says, if someone wants to extract and maintain a
new gem, that'd be fine. I'd help someone get started with that.

In early 2017, when we discussed our "wishlists", Ben mentioned that
he would like to drop `authenticates_many`. At that time, I was using
it at work, but I am not using it any longer.

It's a useful feature, but I'd like to see Authlogic "core" do less.

As the message says, if someone wants to extract and maintain a
new gem, that'd be fine. I'd help someone get started with that.
Copy link
Collaborator

@tiegz tiegz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jaredbeck jaredbeck merged commit 7b178af into master Sep 21, 2018
@jaredbeck jaredbeck deleted the depr_auth_many branch September 21, 2018 21:09
@josh-m-sharpe
Copy link
Contributor

Does anyone know if this has been extracted elsewhere? A bit of searching hasn't found anything.

@jaredbeck
Copy link
Collaborator Author

As the message says, if someone wants to extract and maintain a
new gem, that'd be fine. I'd help someone get started with that.

Does anyone know if this has been extracted elsewhere? A bit of searching hasn't found anything.

No one has volunteered yet, but my offer to help them get started still stands.

Take a look at Relation.scoping. At work, I was able to replace AuthenticatesMany with a single call to scoping.

@josh-m-sharpe
Copy link
Contributor

Ah, excellent - that seems to have done the trick. Thanks!

@mdchaney
Copy link

Take a look at Relation.scoping. At work, I was able to replace AuthenticatesMany with a single call to scoping.

Can you give an example of how you did this? In the old way of doing it, I would find "current_company" based on the domain name, then do something like this:

@user_session = current_company.user_sessions.find

I cannot think of how Relation.scoping would work here.

@josh-m-sharpe
Copy link
Contributor

josh-m-sharpe commented Aug 12, 2019

@mdchaney

Member.where(organization_id: current_org.id).scoping do
  session = MemberSession.new({
    email: params[:email],
    password: params[:password]
  })

  result = session.save

  # do something with result
end

@mdchaney
Copy link

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.

None yet

4 participants