Skip to content

Support procs for validation conditions #5601

@rmosolgo

Description

@rmosolgo

Rails supports procs for validation so that the validation can use a new value for each check, for example:

argument :name, String,
  validates: { length: {
    minimum: 1,
    maximum: -> { Current.account.name_length_limit } 
  }
}

We can support some amount of this, too.

Probably not as much as Rails: validators run before runtime objects are actually ready, and they run once per AST node, not once per object, so we won't be able to pass the object into the proc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions