revise: ugly hack to circumvent acitve record to explode because _two_ (yes TWO. in numbers: 2) instances of the Tracker class are loaded at the same time.

pull/1186/head
Philipp Tessenow 12 years ago
parent f2c9fa93ef
commit 1845c2b6ba
  1. 14
      app/controllers/issues_controller.rb

@ -312,10 +312,18 @@ private
@issue.project = @project
# Tracker must be set before custom field values
@issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first)
if @issue.tracker.nil?
render_error l(:error_no_tracker_in_project)
return false
new_tracker = @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first)
if new_tracker
# XXX: ugly hack. Somehow _two_ different Tracker classes are loaded here (sometimes).
# If that happens ActiveRecord explodes, as it thinks we dont get a Tracker object (which is not true)
new_tracker.is_a?(Tracker) ?
@issue.tracker = new_tracker :
@issue.tracker = Tracker.find(new_tracker.id)
else
render_error l(:error_no_tracker_in_project)
return false
end
end
@issue.start_date ||= User.current.today if Setting.issue_startdate_is_adddate?
if params[:issue].is_a?(Hash)

Loading…
Cancel
Save