From a04060fb6fe006b1dbc224263dd6c39525733c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 8 Jun 2010 01:02:45 +0200 Subject: Really make include_root_in_json default to true [#3770 state:resolved] --- activemodel/lib/active_model/serializers/json.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'activemodel/lib') diff --git a/activemodel/lib/active_model/serializers/json.rb b/activemodel/lib/active_model/serializers/json.rb index ffdfbfcaaf..90305978c4 100644 --- a/activemodel/lib/active_model/serializers/json.rb +++ b/activemodel/lib/active_model/serializers/json.rb @@ -1,5 +1,5 @@ require 'active_support/json' -require 'active_support/core_ext/class/attribute_accessors' +require 'active_support/core_ext/class/attribute' module ActiveModel module Serializers @@ -10,7 +10,8 @@ module ActiveModel included do extend ActiveModel::Naming - cattr_accessor :include_root_in_json, :instance_writer => true + class_attribute :include_root_in_json + self.include_root_in_json = true end # Returns a JSON string representing the model. Some configuration is @@ -92,7 +93,9 @@ module ActiveModel end def from_json(json) - self.attributes = ActiveSupport::JSON.decode(json) + hash = ActiveSupport::JSON.decode(json) + hash = hash.values.first if include_root_in_json + self.attributes = hash self end end -- cgit v1.2.3 From 32d4330b8185caa05af6ae69b0769b34b5e159eb Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 8 Jun 2010 14:46:26 -0400 Subject: Get ready for beta 4 --- activemodel/lib/active_model/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activemodel/lib') diff --git a/activemodel/lib/active_model/version.rb b/activemodel/lib/active_model/version.rb index aac47d5f81..c36fc8b1f7 100644 --- a/activemodel/lib/active_model/version.rb +++ b/activemodel/lib/active_model/version.rb @@ -3,7 +3,7 @@ module ActiveModel MAJOR = 3 MINOR = 0 TINY = 0 - BUILD = "beta3" + BUILD = "beta4" STRING = [MAJOR, MINOR, TINY, BUILD].join('.') end -- cgit v1.2.3