Module: Internationalize::Validations

Extended by:
ActiveSupport::Concern
Included in:
Model
Defined in:
lib/internationalize/validations.rb

Overview

Validation support for internationalized attributes

For simple validations (presence, length, format), use standard Rails validations which work with the virtual accessor for the current locale:

validates :title, presence: true
validates :title, length: { minimum: 3 }

Use validates_international for:

  • Uniqueness (requires JSON column querying)
  • Multi-locale presence (admin interfaces editing all translations at once)

Examples:

Uniqueness per-locale

validates_international :title, uniqueness: true

Require specific locales (admin/manager interfaces)

validates_international :title, presence: { locales: [:en, :de] }