Sha256: 826eb28138440bc40484a143e97168ee39f1ead7497b37655942e3601870394a

Contents?: true

Size: 961 Bytes

Versions: 1

Compression:

Stored size: 961 Bytes

Contents

require 'active_model'
require 'active_support'
require 'active_validation/version'

ACTIVE_VALIDATION_VALIDATORS ||= %w(
  alpha alpha_numeric base64 boolean coordinate credit_card currency cusip email equality hex imei
  ip isbn isin mac_address name password phone sedol slug ssn tracking_number type url username uuid
).freeze

ACTIVE_VALIDATION_VALIDATORS.each do |file_name|
  require "active_validation/validators/#{file_name}_validator"
end

if defined?(Rails)
  require 'rails'

  module ActiveValidation
    class Railtie < ::Rails::Railtie

      initializer 'active_validation' do |app|
        ActiveValidation::Railtie.instance_eval do
          [app.config.i18n.available_locales].flatten.each do |locale|
            (I18n.load_path << path(locale)) if File.file?(path(locale))
          end
        end
      end

      def self.path(locale)
        File.expand_path("../../config/locales/#{locale}.yml", __FILE__)
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_validation-4.0.5 lib/active_validation.rb