aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbdelkader Boudih <terminale@gmail.com>2014-08-17 01:06:30 +0000
committerAbdelkader Boudih <terminale@gmail.com>2014-08-17 23:10:45 +0000
commit2f7b239fca6630e49ba8ad9df6fc7db25e1080f0 (patch)
tree3de16393c2c3ff4fcf1534c28e700b937a3c05b6
parent59221cc4f1b8f87553455aad26905c4f28b424f8 (diff)
downloadrails-2f7b239fca6630e49ba8ad9df6fc7db25e1080f0.tar.gz
rails-2f7b239fca6630e49ba8ad9df6fc7db25e1080f0.tar.bz2
rails-2f7b239fca6630e49ba8ad9df6fc7db25e1080f0.zip
[ActiveJob] Use globalid gem
-rw-r--r--Gemfile1
-rw-r--r--actionmailer/test/base_test.rb1
-rw-r--r--activejob/README.md4
-rw-r--r--activejob/activejob.gemspec3
-rw-r--r--activejob/lib/active_job.rb1
-rw-r--r--activejob/lib/active_job/arguments.rb7
-rw-r--r--activejob/lib/active_job/enqueuing.rb2
-rw-r--r--activejob/test/helper.rb2
-rw-r--r--activejob/test/models/person.rb4
9 files changed, 11 insertions, 14 deletions
diff --git a/Gemfile b/Gemfile
index d059926fdb..dc6dc855a2 100644
--- a/Gemfile
+++ b/Gemfile
@@ -36,6 +36,7 @@ end
gem 'dalli', '>= 2.2.1'
# ActiveJob
+gem 'globalid', github: 'rails/globalid'
gem 'resque', require: false
gem 'resque-scheduler', require: false
gem 'sidekiq', require: false
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb
index c17e59f746..fc24639bf4 100644
--- a/actionmailer/test/base_test.rb
+++ b/actionmailer/test/base_test.rb
@@ -4,7 +4,6 @@ require 'set'
require 'action_dispatch'
require 'active_support/time'
-require 'active_support/core_ext/object/itself'
require 'mailers/base_mailer'
require 'mailers/proc_mailer'
diff --git a/activejob/README.md b/activejob/README.md
index ebb7876c81..e48070bcfc 100644
--- a/activejob/README.md
+++ b/activejob/README.md
@@ -59,7 +59,7 @@ That's it!
## GlobalID support
-Active Job supports [GlobalID serialization](https://github.com/rails/activemodel-globalid/) for parameters. This makes it possible
+Active Job supports [GlobalID serialization](https://github.com/rails/globalid/) for parameters. This makes it possible
to pass live Active Record objects to your job instead of class/id pairs, which
you then have to manually deserialize. Before, jobs would look like this:
@@ -82,7 +82,7 @@ class TrashableCleanupJob
end
```
-This works with any class that mixes in ActiveModel::GlobalIdentification, which
+This works with any class that mixes in GlobalID::Identification, which
by default has been mixed into Active Record classes.
diff --git a/activejob/activejob.gemspec b/activejob/activejob.gemspec
index fd551e540e..d609bb8fce 100644
--- a/activejob/activejob.gemspec
+++ b/activejob/activejob.gemspec
@@ -18,6 +18,5 @@ Gem::Specification.new do |s|
s.files = Dir['CHANGELOG.md', 'MIT-LICENSE', 'README.md', 'lib/**/*']
s.require_path = 'lib'
- s.add_dependency 'activesupport', version
- s.add_dependency 'activemodel-globalid'
+ s.add_dependency 'globalid'
end
diff --git a/activejob/lib/active_job.rb b/activejob/lib/active_job.rb
index f0a34ffb44..ef92406725 100644
--- a/activejob/lib/active_job.rb
+++ b/activejob/lib/active_job.rb
@@ -24,6 +24,7 @@
require 'active_support'
require 'active_support/rails'
require 'active_job/version'
+require 'global_id'
module ActiveJob
extend ActiveSupport::Autoload
diff --git a/activejob/lib/active_job/arguments.rb b/activejob/lib/active_job/arguments.rb
index 8486a9e918..b7572b0e29 100644
--- a/activejob/lib/active_job/arguments.rb
+++ b/activejob/lib/active_job/arguments.rb
@@ -1,6 +1,3 @@
-require 'active_model/global_locator'
-require 'active_model/global_identification'
-
module ActiveJob
module Arguments
extend self
@@ -17,7 +14,7 @@ module ActiveJob
private
def serialize_argument(argument)
case argument
- when ActiveModel::GlobalIdentification
+ when GlobalID::Identification
argument.global_id.to_s
when *TYPE_WHITELIST
argument
@@ -37,7 +34,7 @@ module ActiveJob
when Hash
Hash[ argument.map { |key, value| [ key, deserialize_argument(value) ] } ].with_indifferent_access
else
- ActiveModel::GlobalLocator.locate(argument) || argument
+ GlobalID::Locator.locate(argument) || argument
end
end
diff --git a/activejob/lib/active_job/enqueuing.rb b/activejob/lib/active_job/enqueuing.rb
index c00aab40da..3d00d51867 100644
--- a/activejob/lib/active_job/enqueuing.rb
+++ b/activejob/lib/active_job/enqueuing.rb
@@ -7,7 +7,7 @@ module ActiveJob
module ClassMethods
# Push a job onto the queue. The arguments must be legal JSON types
# (string, int, float, nil, true, false, hash or array) or
- # ActiveModel::GlobalIdentication instances. Arbitrary Ruby objects
+ # GlobalID::Identification instances. Arbitrary Ruby objects
# are not supported.
#
# Returns an instance of the job class queued with args available in
diff --git a/activejob/test/helper.rb b/activejob/test/helper.rb
index 5e491332ee..a56b35da12 100644
--- a/activejob/test/helper.rb
+++ b/activejob/test/helper.rb
@@ -2,6 +2,8 @@ require File.expand_path('../../../load_paths', __FILE__)
require 'active_job'
+GlobalID.app = 'aj'
+
@adapter = ENV['AJADAPTER'] || 'inline'
def sidekiq?
diff --git a/activejob/test/models/person.rb b/activejob/test/models/person.rb
index a5bdbc462b..b31396db4b 100644
--- a/activejob/test/models/person.rb
+++ b/activejob/test/models/person.rb
@@ -1,7 +1,5 @@
-require 'active_model/global_identification'
-
class Person
- include ActiveModel::GlobalIdentification
+ include GlobalID::Identification
attr_reader :id