Created
          May 22, 2013 14:37 
        
      - 
      
 - 
        
Save iamjwc/5628021 to your computer and use it in GitHub Desktop.  
    Question for @apotonick
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class ThingRepresentation < Representable::Decorator | |
| include Representable::JSON | |
| property :field | |
| end | |
| # This works great. | |
| ThingRepresentation.new(Thing.new).to_json # => { "field": "thing value" } | |
| # This does not work. | |
| ThingRepresentation.new([Thing.new, Thing.new]).to_json # => [{ "field": "thing1 value" }, { "field": "thing2 value" }] | |
| # How can I achieve this? | |
| # This seems to be close to what I want: https://github.com/apotonick/representable/pull/22 | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
In representable-1.5.1 this will work.