Skip to content

Protection from passing wrong symbols/strings to enums. #96

@mainameiz

Description

@mainameiz

First of all, thank you for writing such a good gem. :-)

class Model < AR
  as_enum :state, {
    accept: 0,
    reject: 1
  }
end

Model.states[:wrong_state] => nil

It seems to be better to raise an exception in such cases.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions