Fixed: wiki pages with cyrillic characters not found with postgresql (#7245).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4680 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
88727bf070
commit
f1a5dca2ba
|
@ -45,11 +45,11 @@ class Wiki < ActiveRecord::Base
|
||||||
# find the page with the given title
|
# find the page with the given title
|
||||||
def find_page(title, options = {})
|
def find_page(title, options = {})
|
||||||
title = start_page if title.blank?
|
title = start_page if title.blank?
|
||||||
title = Wiki.titleize(title).downcase
|
title = Wiki.titleize(title)
|
||||||
page = pages.first(:conditions => ["LOWER(title) LIKE ?", title])
|
page = pages.first(:conditions => ["LOWER(title) LIKE LOWER(?)", title])
|
||||||
if !page && !(options[:with_redirect] == false)
|
if !page && !(options[:with_redirect] == false)
|
||||||
# search for a redirect
|
# search for a redirect
|
||||||
redirect = redirects.first(:conditions => ["LOWER(title) LIKE ?", title])
|
redirect = redirects.first(:conditions => ["LOWER(title) LIKE LOWER(?)", title])
|
||||||
page = find_page(redirect.redirects_to, :with_redirect => false) if redirect
|
page = find_page(redirect.redirects_to, :with_redirect => false) if redirect
|
||||||
end
|
end
|
||||||
page
|
page
|
||||||
|
|
|
@ -62,4 +62,10 @@ wiki_pages_009:
|
||||||
wiki_id: 2
|
wiki_id: 2
|
||||||
protected: false
|
protected: false
|
||||||
parent_id: 8
|
parent_id: 8
|
||||||
|
wiki_pages_010:
|
||||||
|
created_on: 2007-03-08 00:18:07 +01:00
|
||||||
|
title: Этика_менеджмента
|
||||||
|
id: 10
|
||||||
|
wiki_id: 1
|
||||||
|
protected: false
|
||||||
|
parent_id:
|
||||||
|
|
|
@ -46,6 +46,9 @@ class WikiTest < ActiveSupport::TestCase
|
||||||
assert_equal page, wiki.find_page('Another_page')
|
assert_equal page, wiki.find_page('Another_page')
|
||||||
assert_equal page, wiki.find_page('Another page')
|
assert_equal page, wiki.find_page('Another page')
|
||||||
assert_equal page, wiki.find_page('ANOTHER page')
|
assert_equal page, wiki.find_page('ANOTHER page')
|
||||||
|
|
||||||
|
page = WikiPage.find(10)
|
||||||
|
assert_equal page, wiki.find_page('Этика_менеджмента')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_titleize
|
def test_titleize
|
||||||
|
|
Loading…
Reference in New Issue