Class: ActiveResource::ActiveJobSerializer
- Inherits:
-
ActiveJob::Serializers::ObjectSerializer
- Object
- ActiveJob::Serializers::ObjectSerializer
- ActiveResource::ActiveJobSerializer
- Defined in:
- lib/active_resource/active_job_serializer.rb
Instance Method Summary collapse
Instance Method Details
#deserialize(hash) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/active_resource/active_job_serializer.rb', line 14 def deserialize(hash) hash["class"].constantize.new(hash["attributes"]).tap do |resource| resource.persisted = hash["persisted"] resource. = hash["prefix_options"] end end |
#serialize(resource) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/active_resource/active_job_serializer.rb', line 5 def serialize(resource) super( "class" => resource.class.name, "persisted" => resource.persisted?, "prefix_options" => resource..as_json, "attributes" => resource.attributes.as_json ) end |