diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 7b3684c85..6433acc5f 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -287,9 +287,9 @@ private sort_update(@query.sortable_columns, 'issues_index_sort') limit = 500 issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1)) - if (idx = issue_ids.index(@issue.id.to_s)) && idx < limit - @prev_issue_id = issue_ids[idx - 1].to_i if idx > 0 - @next_issue_id = issue_ids[idx + 1].to_i if idx < (issue_ids.size - 1) + if (idx = issue_ids.index(@issue.id)) && idx < limit + @prev_issue_id = issue_ids[idx - 1] if idx > 0 + @next_issue_id = issue_ids[idx + 1] if idx < (issue_ids.size - 1) end end end diff --git a/lib/redmine/core_ext/active_record.rb b/lib/redmine/core_ext/active_record.rb index ba57b639a..f881f90a5 100644 --- a/lib/redmine/core_ext/active_record.rb +++ b/lib/redmine/core_ext/active_record.rb @@ -27,7 +27,7 @@ module ActiveRecord def find_ids_with_associations(options = {}) catch :invalid_query do join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, merge_includes(scope(:find, :include), options[:include]), options[:joins]) - return connection.select_values(construct_ids_finder_sql_with_included_associations(options, join_dependency)) + return connection.select_values(construct_ids_finder_sql_with_included_associations(options, join_dependency)).map(&:to_i) end [] end diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index 6fc0bd2e8..78499bfd0 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -616,7 +616,7 @@ class QueryTest < ActiveSupport::TestCase q = Query.new(:name => '_') order = "issues.subject, issues.id" issues = q.issues(:order => order) - assert_equal issues.map(&:id).map(&:to_s), q.issue_ids(:order => order) + assert_equal issues.map(&:id), q.issue_ids(:order => order) end def test_label_for