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

How to retrieve field types

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Community Answered
    • Affects Version/s: 5.0.0
    • Fix Version/s: 12_01_17
    • Component/s: None
    • Labels:
    • Environment:
      all

      Description

      I know how to get field names defined in document model.
      document.attribute_names.each do |attr_name|

      What I can not find out is how do I get field types. I could probably read first document and use document.field_name.class, but this doesn't help with fields with nil value.

      Can you advice me how to get field types and default value definitions.

      Thank you
      Damjan Rems

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            ther Damjan Rems
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: