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
The associations generated by groupify and has_members methods lack the inverse_of option.
It should be possible to enable this on a per-call basis to keep backwards compatibility.
Example usage:
class Organization < Group
has_members :managers,
inverse_of: true
end
Which would generate
class Organization < ActiveRecord::Base
has_many :managers,
through: :group_memberships_as_group,
inverse_of: :organizations,
... # The rest of the options
end
Alternatively allow the developer to merge in a (whitelisted?) set of extra keys to the association options hash.
Example of that:
class Organization < Group
has_members :managers,
inverse_of: :organizations
end
I would be in favor of passing in association options.
For inverse_of specifically, in Rails 4 it is usually inferred automatically, so it doesn't need to be specified unless the names don't match up. So association options would allow that configuration to be put in place.
@juhazi Please check out #61 - it allows you to specify custom association options using the has_group or has_member helpers for each association you want to create rather than using has_groups or has_members. Let me know if this does what you need. Thanks.
The associations generated by
groupify
andhas_members
methods lack theinverse_of
option.It should be possible to enable this on a per-call basis to keep backwards compatibility.
Example usage:
Which would generate
Alternatively allow the developer to merge in a (whitelisted?) set of extra keys to the association options hash.
Example of that:
For more info on inverse_of specifically: https://www.viget.com/articles/exploring-the-inverse-of-option-on-rails-model-associations
The text was updated successfully, but these errors were encountered: