lib/active_model/serializers/json.rb in activemodel-5.0.7.2 vs lib/active_model/serializers/json.rb in activemodel-5.1.0.beta1
- old
+ new
@@ -1,6 +1,6 @@
-require 'active_support/json'
+require "active_support/json"
module ActiveModel
module Serializers
# == Active \Model \JSON \Serializer
module JSON
@@ -132,10 +132,10 @@
# person = Person.new
# person.from_json(json, true) # => #<Person:0x007fec5e7a0088 @age=22, @awesome=true, @name="bob">
# person.name # => "bob"
# person.age # => 22
# person.awesome # => true
- def from_json(json, include_root=include_root_in_json)
+ def from_json(json, include_root = include_root_in_json)
hash = ActiveSupport::JSON.decode(json)
hash = hash.values.first if include_root
self.attributes = hash
self
end