I have Group, Membership, and User models. Associated with has_many: through union. The route is wise, membership is nested within the group.
I want that whenever someone joins or leaves a group (i.e. creates or destroys membership), initiates a group check to check what the dominant language is (this is an attribute in the user model) and update the language attribute in the model groups.
I have a method called define_language in a Group model that works independently.
Now I need to call this method from the Membership model, I was thinking of doing this using after_save callback , but I had a problem referring to this method on the (different) Group model method .
I put this method in a group model, not a membership model, because I feel that semantically it has little to do with membership. Is this assumption wrong? How can I effectively solve this problem?
source
share