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
Hello & thank you for all of your work! Rolify has been amazing to work with!
For a project, I need to be able to assign Roles to both Users and Invitations. My first guess would be to use a polymorphic association in the join table between them, allowing it to accept either Users or Invitations.
I did a little research into/with the source code, and it seems that this is currently not possible due to the has_and_belongs_to_many in the rolify method, which doesn't support polymorphism. Changing it to a has_many :through would be a great step in the direction of supporting polymorphism on the User side. Just for reference, #411 and #318 are related to this proposed change, with a pending PR at #181.
If I understand correctly, I also need to pass an as: parameter to the has_many :join_table in the rolify method, so that rolified models know that they are polymorphic and can set the :roleable_type in the join table.
Thanks again for all the work, it's been a blast!
The text was updated successfully, but these errors were encountered:
Hello & thank you for all of your work! Rolify has been amazing to work with!
For a project, I need to be able to assign Roles to both Users and Invitations. My first guess would be to use a polymorphic association in the join table between them, allowing it to accept either Users or Invitations.
I did a little research into/with the source code, and it seems that this is currently not possible due to the
has_and_belongs_to_many
in therolify
method, which doesn't support polymorphism. Changing it to ahas_many :through
would be a great step in the direction of supporting polymorphism on the User side. Just for reference, #411 and #318 are related to this proposed change, with a pending PR at #181.If I understand correctly, I also need to pass an
as:
parameter to thehas_many :join_table
in therolify
method, so that rolified models know that they are polymorphic and can set the:roleable_type
in the join table.Thanks again for all the work, it's been a blast!
The text was updated successfully, but these errors were encountered: