title: How do I specify polymorphic types with graphql-ruby?
body: <p>I have a UserType and a userable that can be a Writer or Account.</p>
  
  <p>For GraphQL I figured maybe I could use a UserableUnion like this:</p>
  
  <pre><code>UserableUnion = GraphQL::UnionType.define do
    name "Userable"
    description "Account or Writer object"
    possible_types [WriterType, AccountType]
  end
  </code></pre>
  
  <p>and then define my UserType like this: </p>
  
  <pre><code>UserType = GraphQL::ObjectType.define do
    name "User"
    description "A user object"
    field :id, !types.ID
    field :userable, UserableUnion
  end
  </code></pre>
  
  <p>But I get <code>schema contains Interfaces or Unions, so you must define a 'resolve_type (obj, ctx) -&gt; { ... }' function</code></p>
  
  <p>I have tried putting a resolve_type in multiple places, but I can't seem to figure this out?</p>
  
  <p>Does any one now how to implement this?</p>