fernandokosh / redmine_time_tracker

A time tracker plugin for Redmine
Other
203 stars 141 forks source link

Saving times does not work with current Redmine SVN r4305 #30

Closed zech closed 13 years ago

zech commented 13 years ago
A NoMethodError occurred in timelog#edit:
undefined method `attributes=' for nil:NilClass
[RAILS_ROOT]/app/controllers/timelog_controller.rb:112:in `edit'

When stopping Time Tracker the following URL is called: https://mydomain.de/timelog/edit?issue_id=22&time_entry%5Bhours%5D=0.03

resulting in the above mentioned internal error.

NoMethodError (undefined method `attributes=' for nil:NilClass):
  app/controllers/timelog_controller.rb:112:in `edit'
  passenger (2.2.15) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
  passenger (2.2.15) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
  passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:441:in `start_request_handler'
  passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:381:in `handle_spawn_application'
  passenger (2.2.15) lib/phusion_passenger/utils.rb:252:in `safe_fork'
  passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:377:in `handle_spawn_application'
  passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
  passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
  passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
  passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:163:in `start'
  passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:222:in `start'
  passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:253:in `spawn_rails_application'
  passenger (2.2.15) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
  passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:247:in `spawn_rails_application'
  passenger (2.2.15) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
  passenger (2.2.15) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
  passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:246:in `spawn_rails_application'
  passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:145:in `spawn_application'
  passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:278:in `handle_spawn_application'
  passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
  passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
  passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
delaitre commented 13 years ago

Maxim Shalaev has reported this issue on the redmine forum: http://www.redmine.org/boards/3/topics/12026?r=18494#message-18494

He says:

Trunk release of redmine with time tracker plugin (version 0.3) send internal error 500 when timer is stop. To fix it i make changes in time_tracker_controller.rb line 34: redirect_to :controller => 'timelog', :action => 'new', :issue_id => issue_id, :time_entry => { :hours => hours}

However, this fix will not be backward compatible.

zech commented 13 years ago

Thanks for this hint. Works like a charm. I think this is a permanent change to redmine so further versions of this plugin should have this build in as soon as this route change is integrated in a stable version of redmine.

delaitre commented 13 years ago

I agree. The recent 1.0.3 redmine release does not seem to include so I will postpone the fix until it is needed by an official redmine release.

delaitre commented 13 years ago

Thanks to MischaTheEvil, the master branch contains a fix which make the plugin compatible with both redmine 1.0.x and redmine trunk.

MischaTheEvil commented 13 years ago

Zech,

This should be fixed in master remaining backwards compatible with Redmine 1.0.x. Could you please test and report back? Thanks in advance.

delaitre commented 13 years ago

Well, I've just though of #9 and the changes I've just merged don't allow to do it cleanly. I think I will make a plugin release if I have feedback on this fix quickly (i.e. before redmine 1.1.0 is released).

Then, I will make a new release which drops redmine 1.0.x support and implements #9.

What do you think?

zech commented 13 years ago

Hi,

just updated to your master. it works now with Redmine 1.0.5.devel.4574 (MySQL). your idea sounds good if i just have to do the fix stated above until 1.1.0 is out. but it is a bad workaround because i always have to revert git to keep up with your development. but you don't have to worry about this ;)