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
It will get an exception because ActiveRecord is found on Mobility module first (the original ActiveRecord from rails is further down in the ancestors chain.
The fix on the user's side would be to qualify top level lookup with ::ActiveRecord but I don't know how happy the users of Mobility would be if they had to do it.
Another would be to rename the ActiveRecord module in Mobility, which would kind of diminish the descriptiveness.
Do you have other suggestions on how to approach this issue?
The text was updated successfully, but these errors were encountered:
Wow, nice catch. Never even considered this problem.
There's one easy way to fix it, just extend Mobility instead of including it. Then it's not in the ancestors chain of the model, and internally that is what Mobility is doing anyway:
I think for this, maybe a note in the readme mentioning that both include and extend will work, but extend is preferred for this reason. I should probably change examples to use extend too.
When Mobility is loaded for ActiveRecord, it includes
Mobility::ActiveRecord
modulemobility/lib/mobility.rb
Line 86 in b001a29
If the
ActiveRecord::Base
subclass that now includesMobility
did something like the following before:It will get an exception raised:
It will get an exception because
ActiveRecord
is found onMobility
module first (the originalActiveRecord
from rails is further down in the ancestors chain.The fix on the user's side would be to qualify top level lookup with
::ActiveRecord
but I don't know how happy the users of Mobility would be if they had to do it.Another would be to rename the
ActiveRecord
module in Mobility, which would kind of diminish the descriptiveness.Do you have other suggestions on how to approach this issue?
The text was updated successfully, but these errors were encountered: