@@ -287,9 +287,9 private | |||
|
287 | 287 | sort_update(@query.sortable_columns, 'issues_index_sort') |
|
288 | 288 | limit = 500 |
|
289 | 289 | issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1)) |
|
290 |
if (idx = issue_ids.index(@issue.id |
|
|
291 |
@prev_issue_id = issue_ids[idx - 1] |
|
|
292 |
@next_issue_id = issue_ids[idx + 1] |
|
|
290 | if (idx = issue_ids.index(@issue.id)) && idx < limit | |
|
291 | @prev_issue_id = issue_ids[idx - 1] if idx > 0 | |
|
292 | @next_issue_id = issue_ids[idx + 1] if idx < (issue_ids.size - 1) | |
|
293 | 293 | end |
|
294 | 294 | end |
|
295 | 295 | end |
@@ -27,7 +27,7 module ActiveRecord | |||
|
27 | 27 | def find_ids_with_associations(options = {}) |
|
28 | 28 | catch :invalid_query do |
|
29 | 29 | join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, merge_includes(scope(:find, :include), options[:include]), options[:joins]) |
|
30 | return connection.select_values(construct_ids_finder_sql_with_included_associations(options, join_dependency)) | |
|
30 | return connection.select_values(construct_ids_finder_sql_with_included_associations(options, join_dependency)).map(&:to_i) | |
|
31 | 31 | end |
|
32 | 32 | [] |
|
33 | 33 | end |
@@ -616,7 +616,7 class QueryTest < ActiveSupport::TestCase | |||
|
616 | 616 | q = Query.new(:name => '_') |
|
617 | 617 | order = "issues.subject, issues.id" |
|
618 | 618 | issues = q.issues(:order => order) |
|
619 |
assert_equal issues.map(&:id |
|
|
619 | assert_equal issues.map(&:id), q.issue_ids(:order => order) | |
|
620 | 620 | end |
|
621 | 621 | |
|
622 | 622 | def test_label_for |
General Comments 0
You need to be logged in to leave comments.
Login now