Skip to content

with_any_role(:role1, :role2) on User Object returns Array instead of ActiveRecord::Relation #292

@FreeApophis

Description

@FreeApophis

with_any_role(:role1, :role2) on User Object returns Array instead of ActiveRecord::Relation

This is a rather tiny issue, but it is rather surprising, since with_role already correctly returns a Relation Object which you can easily chain.
The problem showed up when I chained other Database scopes, and the temporary solution is to do the with_any_role at the end of the chain. This conflicts with other scopes like pagination, and of course the Array cannot be evaluated lazily.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions