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
Again, this was only surfaced because of a bug in another gem. I thought I would bring it up here in case it is desired that it be fixed in rolify as well.
The code below would resolve the issue in a defensive manor.
This is a bit of a weird one and only surfaced because of a bug in another gem. I don't believe it should be an issue under normal circumstances.
I ran into an issue in another gem where, during runtime, it was causing a rails model to become a subclass of itself. Because of that this method https://github.com/RolifyCommunity/rolify/blob/master/lib/rolify/adapters/base.rb#L27-L29 was returning the same class multiple times (ie.
['Organization', 'Organization']
).The above issue caused bad queries to be generated here: https://github.com/RolifyCommunity/rolify/blob/master/lib/rolify/adapters/active_record/resource_adapter.rb#L14-L19. This resulted in
...INNER JOIN roles ON roles.resource_type IN ('Organization''Organization') AND...
to appear in the query; which of course is invalid.Again, this was only surfaced because of a bug in another gem. I thought I would bring it up here in case it is desired that it be fixed in rolify as well.
The code below would resolve the issue in a defensive manor.
Alternatively, this is the problematic line https://github.com/RolifyCommunity/rolify/blob/master/lib/rolify/adapters/active_record/resource_adapter.rb#L17. It could be changed to use the array index instead of the value.
The text was updated successfully, but these errors were encountered: