Sha256: 6e0f780600aade6dd02970ca8d6e6fe2de7fa815027937717515e6ae61786f0e

Contents?: true

Size: 1012 Bytes

Versions: 8

Compression:

Stored size: 1012 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

8 entries across 8 versions & 1 rubygems

Version Path
validates_timeliness-5.0.1 lib/validates_timeliness/railtie.rb
validates_timeliness-6.0.1 lib/validates_timeliness/railtie.rb
validates_timeliness-6.0.0 lib/validates_timeliness/railtie.rb
validates_timeliness-6.0.0.beta2 lib/validates_timeliness/railtie.rb
validates_timeliness-6.0.0.beta1 lib/validates_timeliness/railtie.rb
validates_timeliness-6.0.0.alpha1 lib/validates_timeliness/railtie.rb
validates_timeliness-5.0.0 lib/validates_timeliness/railtie.rb
validates_timeliness-5.0.0.beta2 lib/validates_timeliness/railtie.rb