Makes .find_ids return integers.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8490 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
ce45b03732
commit
86a52eaedf
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue