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

Skipp callbacks in Mongoid

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.15
    • Affects Version/s: None
    • Component/s: None
    • None

      I have a entity.
      And it hase two callbacks :
      before_save :fields_to_model
      after_initialize :model_to_fields

      And I want skip my callbacks in cucumber tests:
      I try:

      Conference.skip_callback(:save, :before)
      @conference = FactoryGirl.build(:conference, user: @user)
      @conference.save(validate: false)
      Conference.set_callback(:save, :before)

      But before_save callback invokes again.
      Q: How can I disable callbacks in Mongoid at runtime?

            Assignee:
            Unassigned Unassigned
            Reporter:
            JohnBat26 JohnBat26 [X]
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: