apotonick/roar — Issue #12: JSON representations do no include object type
Author: midas
Created: 2012-02-18 19:09:49+00:00
State: open

When I:

class Widget
attr_accessor :id, :name
end

module WidgetRepresenter
include Roar::Representer::JSON

property :id
property :name
end

w = Widget.new
w.id = 1
w.name = 'Thing'
w.extend( WidgetRepresenter )
w.to_json # => "{\"id\":1,\"name\":\"Thing\"}"

I would expect (from your README) to see something like:

{ 'widget': { 'id': 1, 'name': 'Thing' } } (this is unescaped, of course)