NoMethodError "remove_item" after installing Backlogs plugin

Added by Ezequiel G. B. almost 11 years ago

Hello everyone!

I've just installed the Backlogs plugin, run the migration scripts and it's working fine. The thing now is that we can't delete issues! We get a 500 Internal Server Error and this in the log:

NoMethodError (undefined method `remove_item' for #<Class:0xb73229b0>):
  vendor/plugins/redmine_backlogs/relaxdiego-backlogs-e724049/lib/issue_patch.rb:28:in `remove_item'
  app/controllers/issues_controller.rb:340:in `each'
  app/controllers/issues_controller.rb:340:in `destroy'
  /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
  /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
  /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
  /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
  /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
  /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendering /opt/redmine/public/500.html (500 Internal Server Error)

What could've gone wrong? Could anybody give me a hand?

Thanks in advance,
Ezequiel.

Replies (5)

RE: NoMethodError "remove_item" after installing Backlogs plugin - Added by Ricardo Amores over 10 years ago

I've found what it seems a solution for this issue.

The problem seems that the item for the backlog (a model created for the plugin) which is associated to an issue, is registered to be destroyed AFTER the issue, when it should be destroyed before the issue is attached to.

You need to edit the file:
REDMINE_PATH /vendor/plugins/redmine_backlogs/lib/issue_patch.rb

And change the line 13:

after_destroy :remove_item

with this
before_destroy :remove_item

Then restart the redmine server to apply the changes.

Hope it helps

RE: NoMethodError "remove_item" after installing Backlogs plugin - Added by Ezequiel G. B. over 10 years ago

Hi Ricardo!

I have applied your solution, but I still get the same error, even after restarting Redmine.

Could it be something else? Did it work for you?

Thanks!
Ezequiel.

RE: NoMethodError "remove_item" after installing Backlogs plugin - Added by Ricardo Amores over 10 years ago

Sorry, I misread your post. The error you have is not the same as mine. Sorry about that.

I installed the plugin using the last version of the code last week. Is your code up to date? If not, try downloading the last version and rerunning the migrations.

I'll give your error a look, just in case I came up with more solutions.

Hope it helps

RE: NoMethodError "remove_item" after installing Backlogs plugin - Added by Ricardo Amores over 10 years ago

Seems like an old code bug, as the line 28 in issue_patch.rb is now:
Item.remove_with_issue(self)

And you get an error when calling the remove_item method, which belongs to a later commit in the code.

Get the last code from source and reinstall the plugin. Everything should be fine.

Best Regards

RE: NoMethodError "remove_item" after installing Backlogs plugin - Added by Ezequiel G. B. over 10 years ago

Thanks a lot Ricardo! I'll try updating then.

Greetings,
Ezequiel.

(1-5/5)