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

validates_presence_of executes other validations

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

      class Item
         belongs_to :user, inverse_of: :items, index: true
         validates_presence_of :user
      

      When I validates_presence_of is called, it triggers execution of all validations on user as well - something I don't expect.

      For the reference, the inverse looks like this:

      class User
         has_many :items, inverse_of: :user
         validate :my_custom_validation_that_gets_called
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            emirkin Eugene Mirkin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: