Skip to content

stack overflow when accidentally using Enum without .to_i in where #451

@confact

Description

@confact

When doing normal where and use the Enum in the where as you might assume it should work. It throws a stack overflow.
if I do .to_i it works.

I would assume to catch this error with an exception so a stack overflow doesn't happen if it is not supported.

User.where(role: Role::Admin).select.first

will return stack overflow, while:

User.where(role: Role::Admin.to_i).select.first

will work

I use the Enum converter in the model like this:

  column role : Role = Role::Guest, converter: Granite::Converters::Enum(Role, Int32)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions