Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-250

More explicit error when fields and relations overlap on models (minor issue)

    • Type: Icon: Task Task
    • Resolution: Done
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      problem

      If you specify a relationship overlapping with a field there will be problems. Maybe one should add some simple exception explicitly station the problem to save people some time, as I imagine this being a fairly frequent error. New to Rails, so I don't know if this should be handled in Mongoid or perhaps in a rails component? Could be.

      class example

      class Company
      include Mongoid::Document

      // these two will conflict
      referenced_in :country
      field :country, :type => String

      end

      error

      undefined method `target' for "#<Country:0x10224ae48>":String

            Assignee:
            Unassigned Unassigned
            Reporter:
            sandstrom sandstrom
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: