aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Agrawal <arunagw@gmail.com>2018-02-15 10:36:12 +0530
committerGitHub <noreply@github.com>2018-02-15 10:36:12 +0530
commit4865f6b58965078e314a22fdcefdf57ee56675b1 (patch)
tree2a0221be9b8ba73127000ac27302e57c88111dd0
parentfe6adf43e124f4c9132e5a88a80ebba3f10fd2cb (diff)
parent007c7914ff919913461a1e8285d8db07707051e3 (diff)
downloadrails-4865f6b58965078e314a22fdcefdf57ee56675b1.tar.gz
rails-4865f6b58965078e314a22fdcefdf57ee56675b1.tar.bz2
rails-4865f6b58965078e314a22fdcefdf57ee56675b1.zip
Merge pull request #32001 from ydakuka/patch-2
Missing backquote, extra end keyword [ci skip]
-rw-r--r--guides/source/active_job_basics.md35
1 files changed, 17 insertions, 18 deletions
diff --git a/guides/source/active_job_basics.md b/guides/source/active_job_basics.md
index 92a04c585f..9b738e8cdd 100644
--- a/guides/source/active_job_basics.md
+++ b/guides/source/active_job_basics.md
@@ -345,7 +345,7 @@ Supported types for arguments
ActiveJob supports the following types of arguments by default:
- Basic types (`NilClass`, `String`, `Integer`, `Fixnum`, `Bignum`, `Float`, `BigDecimal`, `TrueClass`, `FalseClass`)
- - `Symbol
+ - `Symbol`
- `ActiveSupport::Duration`
- `Date`
- `Time`
@@ -389,25 +389,24 @@ You can extend list of supported types for arguments. You just need to define yo
```ruby
class MoneySerializer < ActiveJob::Serializers::ObjectSerializer
- # Check if this object should be serialized using this serializer.
- def serialize?(argument)
- argument.is_a? Money
- end
+ # Check if this object should be serialized using this serializer.
+ def serialize?(argument)
+ argument.is_a? Money
+ end
- # Convert an object to a simpler representative using supported object types.
- # The recommended representative is a Hash with a specific key. Keys can be of basic types only.
- # You should call `super` to add the custom serializer type to the hash
- def serialize(object)
- super(
- "cents" => object.cents,
- "currency" => object.currency
- )
- end
+ # Convert an object to a simpler representative using supported object types.
+ # The recommended representative is a Hash with a specific key. Keys can be of basic types only.
+ # You should call `super` to add the custom serializer type to the hash
+ def serialize(object)
+ super(
+ "cents" => object.cents,
+ "currency" => object.currency
+ )
+ end
- # Convert serialized value into a proper object
- def deserialize(hash)
- Money.new hash["cents"], hash["currency"]
- end
+ # Convert serialized value into a proper object
+ def deserialize(hash)
+ Money.new hash["cents"], hash["currency"]
end
end
```