summaryrefslogtreecommitdiff
path: root/lib/json/add/rails.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/json/add/rails.rb')
-rw-r--r--lib/json/add/rails.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/json/add/rails.rb b/lib/json/add/rails.rb
index e86ed1a..8ce85ef 100644
--- a/lib/json/add/rails.rb
+++ b/lib/json/add/rails.rb
@@ -10,7 +10,7 @@ class Object
def self.json_create(object)
obj = new
for key, value in object
- next if key == 'json_class'
+ next if key == JSON.create_id
instance_variable_set "@#{key}", value
end
obj
@@ -18,7 +18,7 @@ class Object
def to_json(*a)
result = {
- 'json_class' => self.class.name
+ JSON.create_id => self.class.name
}
instance_variables.inject(result) do |r, name|
r[name[1..-1]] = instance_variable_get name