makandra / active_type

Make any Ruby object quack like ActiveRecord
MIT License
1.09k stars 74 forks source link

1.9.0 update breaks usage with Authlogic #144

Closed chriscz closed 3 years ago

chriscz commented 3 years ago

After updating from 1.8.0 to 1.9.0 he following breaks with an undefined sti_name error, I think the fix could be justchecking whether the extended class respond_to? :sti_name and if not, rather using name.

class UserSession < Authlogic::Session::Base
end

class SignInForm[UserSession]
  attribute :email
  attribute :password
end

For now I just added a sti_name method on the authlogic session.

kratob commented 3 years ago

Hey @chriscz,

This is a somewhat unexpected use case, since we never intended for ActiveType::Record to extend something that is not itself an ActiveRecord or ActiveType::Object. In the case of Authlogic::Session::Base, it kind of works, since that class mimicks ActiveRecord::Base to some extent.

I think adding the sti_name method in that specific case is the correct solution.