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

Error saving embedded documents

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Blocker - P1 Blocker - P1
    • 5.1.0
    • Affects Version/s: None
    • Component/s: None
    • None

      Gist stack trace: https://gist.github.com/washu/df25072fdcc53af6bf58

      Model
      class Lecture

      1. We store in our own collection instead of inheriting
        include Mongoid::Document
        include Mongoid::Timestamps
      2. name of lecture/class
        field :name, type: String, default: ''
      1. description of the class
        field :description, type: String, default: ''
      1. who owns this class/lecture (customers can have thier own class/lecture)
        field :customer, type: String, default: Aztec::AZTEC
      1. Pre test required for class
        field :require_pre_test, type: Boolean, default: false
      1. enable pre test on/off
        field :enable_pre_test, type: Boolean, default: true
      1. enable practice test
        field :enable_practice_test, type: Boolean, default: false
      1. enable practice test
        field :enable_essay_test, type: Boolean, default: false

      embeds_one :pre_test_config, class_name: 'AutomaticTest', inverse_of: :testable
      embeds_one :post_test_config, class_name: 'AutomaticTest', inverse_of: :testable

      1. use customer or automatic tests
        embeds_one :pre_test_custom, class_name: 'ManualTest', inverse_of: :testable
        embeds_one :post_test_custom, class_name: 'ManualTest', inverse_of: :testable
      1. Practice Test is always manula
        embeds_one :practice_test, class_name: 'ManualTest', inverse_of: :testable
      1. Essay Test
        embeds_one :essay_test, class_name: 'ManualTest', inverse_of: :testable
      1. test types
        field :manual_pre_test, type: Boolean, default: false
        field :manual_post_test, type: Boolean, default: false
      1. enable drilling
        field :enable_drill, type: Boolean, default: true
      1. unit of content
        has_and_belongs_to_many :units, index: true
      1. Licenses
        has_and_belongs_to_many :license, index: true
        end
        class AutomaticTest
        include Mongoid::Document
        include Mongoid::Attributes::Dynamic
      2. number of questions per problem sets available
        field :number_of_questions, type: Integer, default: 1
      3. percentage score of the test
        field :passing_score, type: Integer, default: 80
      4. enable timer
        field :enable_timer, type: Boolean, default: false
      5. total time allow for test in minutes
        field :test_time, type: Integer, default: 60
      6. Points per question
        field :points_per_question, type: Integer, default: 1
        field :allow_essay, type: Boolean, default: false
      1. Do we need a calculator?
        field :calculator, type: Boolean, default: false
      2. What calculator do we need
        field :calculator_type, type: String, default: 'GED'
        end
        class ManualTest < AutomaticTest
      3. problems sets to use
        field :problem_set_id, type: BSON::ObjectId
      4. random support
        field :randomize, type: Boolean
        embedded_in :testable , polymorphic: true
        end

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

              Created:
              Updated:
              Resolved: