Skip to content

Rule may need values in the collection #6

@demental

Description

@demental

When adding an extra_validator, we may need to rely on some other values from the current collection. We could add it as an extra param in the validator

class NameOrCompanyValidator < Csv2hash::ExtraValidator

  def valid? rule, value, collection
     value.present? || collection['company'].present?
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions