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