alexbevi / redmine_knowledgebase

A knowledgebase plugin for Redmine
452 stars 199 forks source link

ActiveRecord::StaleObjectError (Attempted to destroy a stale object: KbArticle) #300

Closed eaxdev closed 8 years ago

eaxdev commented 8 years ago

Hi! I have updated to the latest version Redmine and redmine_knowledgebase. I've redmine_knowledgebase 3.1.0 and Redmine version 3.2.0.stable, Ruby version 2.2.3-p173 (2015-08-18) [x86_64-linux], Rails version 4.2.5. I carried articles and categories with the old database, create a shared project, and included a knowledge base. All is well, but when I try to delete or update an article issued this error: Rendered plugins/redmine_knowledgebase/app/views/kb_mailer/article_destroy.html.erb within layouts/mailer (0.2ms) Completed 409 Conflict in 38ms (ActiveRecord: 7.7ms) ActiveRecord::StaleObjectError (Attempted to destroy a stale object: KbArticle): lib/redmine/sudo_mode.rb:63:insudo_mode'` However, no such error when I delete or update an article that has just created.

How this problem can be corrected?

robspearman commented 8 years ago

I see this error when attempting to delete an article if it has comments. I do not see the issue when updating articles.

Environment: Redmine version 3.2.0.stable Ruby version 1.9.3-p448 (2013-06-27) [x86_64-linux] Rails version 4.2.5 Environment development Database adapter Mysql2

Ranjandas commented 8 years ago

I am getting this error when I am trying to delete a KB article (not all kb articles)

Attempted to destroy a stale object: KbArticle

Extracted source (around line #63):              
          SudoMode.active!
        end
        yield
        update_sudo_timestamp! if SudoMode.was_used?
      end

Rails.root: /opt/redmine/redmine

Application Trace | Framework Trace | Full Trace
lib/redmine/sudo_mode.rb:63:in `sudo_mode'
alexbevi commented 8 years ago

Should be fixed in v3.2.0. @robspearman, @Ranjandas, @roma-sk3 please have a look when you have a chance to verify.

jonsen commented 7 years ago

The same problem with version 3.2.1. How can I fix it? Thank you!

ActiveRecord::StaleObjectError (Attempted to update a stale object: KbArticle): plugins/redmine_knowledgebase/app/controllers/articles_controller.rb:126:in update' lib/redmine/sudo_mode.rb:63:insudo_mode'