Closed joelvh closed 7 years ago
I understand the need to customize the associations generated by Groupify.
In this case, I think it will ultimately be simpler and more useful to have a separate has_member
method which takes an association name and a hash of association options.
has_member :users, class_name: 'CustomUserClass'
has_member :admins, class_name: 'CustomAdminClass'
@dwbutler OK, I will refactor with has_member
method and take a look at the tests that are failing.
@dwbutler updated with has_member
method. I also noticed that there was a missing association_name
argument to the associate_member_class
method in Mongoid, which is now added....
@dwbutler closing this in favor of #61, which incorporates this addition.
We wanted to create a
users
association with aCustomUser
class. We added the option to usehas_member :users, class_name: 'CustomUser'
, so you can specify the class for specific associations. This is backwards compatible with just passing in association names tohas_members
.I think that the only change that's missing from Mongoid is
default_members: true
option forhas_member