Authlogic 5 breaks for multi-tenant rails codebase that has account -> users relationship

27 Views Asked by At

I have a rails app which is multi-tenant and has an account model which has_many users

in the models/account.rb file, there is this block of authlogic code that fails when i try to upgrade authlogic gem from 4.5 to 5.0:

authenticates_many :user_sessions
authenticates_many :admin_user_sessions, relationship_name: "users"
authenticates_many :impersonator_sessions, relationship_name: "users"

The error message is:

NoMethodError:
  undefined method `authenticates_many' for #<Class:0x0000000112ef9008>

how do i refactor this code to get authlogic 5.0 working?

1

There are 1 best solutions below

0
Nicholas Ladefoged On

Looking into authlogic changelog for 5.0.0 they have dropped authenticates_many since it was depricated in 4.4.0

check this out: https://github.com/binarylogic/authlogic/blob/5-1-stable/CHANGELOG.md

Sadly tho, its deprecated without replacement as you can see here https://github.com/binarylogic/authlogic/blob/4-5-stable/CHANGELOG.md#440-2018-09-21:~:text=performing%20actual%20validation.-,4.4.0%20(2018%2D09%2D21),-Breaking%20Changes