From 8e08cbf6e4f25e5fdd6f3724c1eb64a0815e22da Mon Sep 17 00:00:00 2001 From: Adam Meehan Date: Sat, 23 Jun 2012 18:58:01 +1000 Subject: [PATCH] Fix load order issue for AR extension using Railite --- lib/validates_timeliness.rb | 4 ++++ lib/validates_timeliness/railtie.rb | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/validates_timeliness.rb b/lib/validates_timeliness.rb index 6e178315..bb05b9a2 100644 --- a/lib/validates_timeliness.rb +++ b/lib/validates_timeliness.rb @@ -58,6 +58,10 @@ def self.parser # Setup method for plugin configuration def self.setup yield self + load_orms + end + + def self.load_orms extend_orms.each {|orm| require "validates_timeliness/orm/#{orm}" } end end diff --git a/lib/validates_timeliness/railtie.rb b/lib/validates_timeliness/railtie.rb index 6b4bb266..6b88d616 100644 --- a/lib/validates_timeliness/railtie.rb +++ b/lib/validates_timeliness/railtie.rb @@ -3,7 +3,8 @@ 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.extend_orms << :active_record + ValidatesTimeliness.load_orms end end