tags:

views:

34

answers:

0

hello,

does anyone know how to do a polymorphic association in mongoid that is of the relational favor but not the embedding one.

For instance class Assignment

      include Mongoid::Document
      include Mongoid::Timestamps

      field :user
      field :due_at, :type => Time

      referenced_in :assignable, :inverse_of => :assignment
    end


    class Project

      include Mongoid::Document
      include Mongoid::Timestamps

      field :name, :type => String

      references_many :assignments
    end

This throws and error saying unknown constant Assignable. When I change the 'reference' to 'embed', this all works as documented in Mongoid.org's documentation. but I need it to be 'reference'.

Thanks!