Sha256: 50bdafae4b4f42b65cadf1e5bfa46f00783c482709788d03127c0087f3278ec3

Contents?: true

Size: 1006 Bytes

Versions: 4

Compression:

Stored size: 1006 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.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

4 entries across 4 versions & 1 rubygems

Version Path
validates_timeliness-8.0.0.beta1 lib/validates_timeliness/railtie.rb
validates_timeliness-7.0.0 lib/validates_timeliness/railtie.rb
validates_timeliness-7.0.0.beta2 lib/validates_timeliness/railtie.rb
validates_timeliness-7.0.0.beta1 lib/validates_timeliness/railtie.rb