class ActiveRecord::Relation

Public: Add entity method to ActiveRecord::Relation class

Examples

User.all.entity(root: 'users').to_json
# => { "users":
        [{
            "title": "Some title"
          },
          {
           "title": "Some title"
          },
          {
           "title": "Some title"
          }]
      }