Calling destroy in after_save callback throws an error

XMLWordPrintableJSON

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

      So I have a model and I am doing some validation inside after_save callback, if the validation fails I need to call the destroy method on the model. But when I do that, I get this error?

      Mongoid::Errors::Callback: Calling save! on ChatMessage resulted in a false return from a callback.
      	from /Users/kapilisrani/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-2.4.10/lib/mongoid/persistence.rb:267:in `fail_callback!'
      	from /Users/kapilisrani/.rvm/gems/ruby-1.9.3-p194/gems/mongoid-2.4.10/lib/mongoid/persistence.rb:77:in `save!'
      	from (irb):128
      

      Using Mongoid 2.4.10 with Rails 3.2.6

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

              Created:
              Updated:
              Resolved: