r22811 changed return type of ProjectQuery#results_scope : Project::ActiveRecord_Relation => Array of Project instance
That change is no impact for Redmine end users. But it is broken backward compatibility for some Redmine plugins which uses ProjectQuery#results_scope . This patch fixes it.
In addition, UserQuery#results_scope (same name method) still returns User::ActiveRecord_Relation . And TimeEntryQuery#results_scope ditto.
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index f9a390c58..11078d89a 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -335,7 +335,9 @@ def bulk_destroy
# Returns the ProjectEntry scope for index
def project_scope(options={})
- @query.results_scope(options)
+ @query.results_scope(options).tap do |result|
+ binding.b
+ end
end
def retrieve_project_query
Open /projects with "Last activity" column.
Then, @last_activity_date instance variable is exists following:
[334,343]in~/src/github.com/agileware-jp/redmine-dev-mirror/app/controllers/projects_controller.rb334|private335|336|# Returns the ProjectEntry scope for index337|defproject_scope(options={})338|@query.results_scope(options).tapdo|result|=>339|binding.b340|end341|end342|343|defretrieve_project_query=>#0 block {|result=[#<Project:0x00007fe246c212c8 id: 1, name...|} in project_scope at ~/src/github.com/agileware-jp/redmine-dev-mirror/app/controllers/projects_controller.rb:339#1 Kernel#tap at <internal:kernel>:90# and 70 frames (use `bt' command for all frames)(ruby)result.to_a.first.instance_variable_get(:@last_activity_date)Fri,01Nov202417:10:02.900305000UTC+00:00(ruby)result.to_a.first.instance_variable_get(:@last_activity_date).classActiveSupport::TimeWithZone
I confirmed that the method works without issues after applying the patch. For the plugin, there might be problems if the class of the returned instance changes, so I would like this patch to be incorporated.