From 0cb85a6e8c1a1a0714ec3bb290ad802d80b1ae07 Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Wed, 21 May 2014 20:45:56 +0000 Subject: Active Job Railtie --- lib/active_job/railitie.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lib/active_job/railitie.rb diff --git a/lib/active_job/railitie.rb b/lib/active_job/railitie.rb new file mode 100644 index 0000000000..e6bd447150 --- /dev/null +++ b/lib/active_job/railitie.rb @@ -0,0 +1,11 @@ +require 'active_model/global_id' +require 'active_job' + +module ActiveJob + # = Active Job Railtie + class Railtie < Rails::Railtie # :nodoc: + initializer 'active_job' do + ActiveSupport.on_load(:active_job) { Base.logger = ::Rails.logger } + end + end +end \ No newline at end of file -- cgit v1.2.3 From af117de37a5183e53f9c23dc9d4743e007a098d0 Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Wed, 21 May 2014 21:10:17 +0000 Subject: Railtie hook on ActiveJob::Base --- lib/active_job.rb | 1 + lib/active_job/base.rb | 2 ++ lib/active_job/railitie.rb | 11 ----------- lib/active_job/railtie.rb | 10 ++++++++++ 4 files changed, 13 insertions(+), 11 deletions(-) delete mode 100644 lib/active_job/railitie.rb create mode 100644 lib/active_job/railtie.rb diff --git a/lib/active_job.rb b/lib/active_job.rb index ba18cc093a..ddfdda4fb4 100644 --- a/lib/active_job.rb +++ b/lib/active_job.rb @@ -24,6 +24,7 @@ require 'active_support' require 'active_support/rails' +require 'active_job/railtie' if defined?(Rails) require 'active_job/version' module ActiveJob diff --git a/lib/active_job/base.rb b/lib/active_job/base.rb index 3d16f38275..d4f0f6777c 100644 --- a/lib/active_job/base.rb +++ b/lib/active_job/base.rb @@ -9,5 +9,7 @@ module ActiveJob extend QueueName extend Enqueuing extend Logging + + ActiveSupport.run_load_hooks(:active_job, self) end end diff --git a/lib/active_job/railitie.rb b/lib/active_job/railitie.rb deleted file mode 100644 index e6bd447150..0000000000 --- a/lib/active_job/railitie.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'active_model/global_id' -require 'active_job' - -module ActiveJob - # = Active Job Railtie - class Railtie < Rails::Railtie # :nodoc: - initializer 'active_job' do - ActiveSupport.on_load(:active_job) { Base.logger = ::Rails.logger } - end - end -end \ No newline at end of file diff --git a/lib/active_job/railtie.rb b/lib/active_job/railtie.rb new file mode 100644 index 0000000000..08555d1d77 --- /dev/null +++ b/lib/active_job/railtie.rb @@ -0,0 +1,10 @@ +require 'active_model/railtie' + +module ActiveJob + # = Active Job Railtie + class Railtie < Rails::Railtie # :nodoc: + initializer 'active_job' do + ActiveSupport.on_load(:active_job) { self.logger = ::Rails.logger } + end + end +end \ No newline at end of file -- cgit v1.2.3