Skip to content

Commit

Permalink
Fix load order issue for AR extension using Railite
Browse files Browse the repository at this point in the history
  • Loading branch information
adzap committed Jun 23, 2012
1 parent 8dd6079 commit 8e08cbf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/validates_timeliness.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion lib/validates_timeliness/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 8e08cbf

Please sign in to comment.