Skip to content

values validator and allow_blank #2185

@maciejpankanin

Description

@maciejpankanin

Consider this params definition:

params do
  requires :id, type: String
  optional :some_param, type: String, values: ["value1", "value2"]
end

Recently I spent couple of hours figuring out why null is valid value for some_param.

I think there should be a few words in documentation about values validator saying that allow_blank defaults to true and it is stronger than supplied values options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions