oddcamp / active_hash_relation

ActiveHash Relation: Simple gem that allows you to run multiple ActiveRecord::Relation using hash. Perfect for APIs.
https://www.kollegorna.se/
MIT License
118 stars 15 forks source link

filter_associations doesn't work when association class is different from association name #30

Closed AmanShurafa closed 2 years ago

AmanShurafa commented 6 years ago

This line in ActiveHashRelation::AssociationFilters.filter_associations: association_name.singularize.constantize.unscoped.all assumes that the association name always matches the association class. As a result, the associations filter doesn't always work as expected on those rare instances where convention cannot be followed. Suggested change: association.class_name.constantize.unscoped.all

vasilakisfil commented 6 years ago

ah interesting! Thanks for noticing out, will fix tonight!

adammartak commented 5 years ago

I found same problem with globalize gem, possible fix could be like here https://github.com/adammartak/active_hash_relation