Project

General

Profile

Actions

Defect #6904

closed

Issue Context Menu- Log Time Broken

Added by Dan Seaver over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Time tracking
Target version:
-
Start date:
2010-11-16
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

While viewing /project/[XXXXX]/issues, if you right click on an issue and select 'Log Time', you get the following error message:

NoMethodError in TimelogController#edit

You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.attributes=
RAILS_ROOT: /Projects/Ruby/Rails/redmine

/Projects/Ruby/Rails/redmine/app/controllers/timelog_controller.rb:113:in `edit'

This is because @time_entry is never initialized, because the line that initialized it was removed in r4248

In r4248, line 114 was removed, the line was

@time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today)

If this line is added back in, the context menu works correctly.

I've added a patch to correct this issue


Files

development.log (1.92 KB) development.log Dan Seaver, 2010-11-16 02:24
timelog_controller.patch (639 Bytes) timelog_controller.patch Dan Seaver, 2010-11-16 02:24
Actions #1

Updated by Jean-Philippe Lang over 13 years ago

  • Category changed from Issues to Time tracking
  • Status changed from New to Closed
  • Resolution set to Fixed

Actually, it was the link that was broken in the context menu and it's fixed in r4409.
Now, TimelogController#edit is for editing an existing timelog only. r4410 prevents the error you mentioned to occur when calling this action without an id.

Thanks for pointing this out.

Actions

Also available in: Atom PDF