aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_job/parameters.rb
blob: a4841abd1e2cb5d2758516430cc8292c997708c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require 'active_model/global_locator'
require 'active_support/core_ext/object/try'

module ActiveJob
  class Parameters
    def self.serialize(params)
      params.collect { |param| param.try(:global_id) || param }
    end
    
    def self.deserialize(params)
      params.collect { |param| ActiveModel::GlobalLocator.locate(param) || param }
    end
  end
end