Sha256: ba80c1639e0c6b7b130a3a1d5a86f31f57ca5ea5c86316a9a78bc2aa2e1140f4

Contents?: true

Size: 1013 Bytes

Versions: 3

Compression:

Stored size: 1013 Bytes

Contents

module ValidatesTimeliness
  class Railtie < Rails::Railtie
    initializer "validates_timeliness.initialize_active_record", :after => 'active_record.initialize_timezone' do
      ActiveSupport.on_load(:active_record) do
        ValidatesTimeliness.default_timezone = ActiveRecord::Base.default_timezone
        ValidatesTimeliness.extend_orms << :active_record
        ValidatesTimeliness.load_orms
      end
    end

    initializer "validates_timeliness.initialize_restriction_errors" do
      ValidatesTimeliness.ignore_restriction_errors = !Rails.env.test?
    end

    initializer "validates_timeliness.initialize_timeliness_ambiguous_date_format", :after => 'load_config_initializers' do
      if Timeliness.respond_to?(:ambiguous_date_format) # i.e. v0.4+
        # Set default for each new thread if you have changed the default using
        # the format switching methods.
        Timeliness.configuration.ambiguous_date_format = Timeliness::Definitions.current_date_format
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
validates_timeliness-5.0.0.beta1 lib/validates_timeliness/railtie.rb
validates_timeliness-5.0.0.alpha5 lib/validates_timeliness/railtie.rb
validates_timeliness-4.1.1 lib/validates_timeliness/railtie.rb