From 794d7c095955d3db90fb172f2b6cdefb804be7f3 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 16 Jan 2011 14:44:38 +0000 Subject: [PATCH] Merged r4680 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.1-stable@4728 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/wiki.rb | 6 +++--- test/fixtures/wiki_pages.yml | 8 +++++++- test/unit/wiki_test.rb | 3 +++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/models/wiki.rb b/app/models/wiki.rb index b28694ec4..c83bd1922 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.rb @@ -45,11 +45,11 @@ class Wiki < ActiveRecord::Base # find the page with the given title def find_page(title, options = {}) title = start_page if title.blank? - title = Wiki.titleize(title).downcase - page = pages.first(:conditions => ["LOWER(title) LIKE ?", title]) + title = Wiki.titleize(title) + page = pages.first(:conditions => ["LOWER(title) LIKE LOWER(?)", title]) if !page && !(options[:with_redirect] == false) # 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 end page diff --git a/test/fixtures/wiki_pages.yml b/test/fixtures/wiki_pages.yml index f1fb19917..2d2e2eceb 100644 --- a/test/fixtures/wiki_pages.yml +++ b/test/fixtures/wiki_pages.yml @@ -62,4 +62,10 @@ wiki_pages_009: wiki_id: 2 protected: false parent_id: 8 - \ No newline at end of file +wiki_pages_010: + created_on: 2007-03-08 00:18:07 +01:00 + title: Этика_менеджмента + id: 10 + wiki_id: 1 + protected: false + parent_id: diff --git a/test/unit/wiki_test.rb b/test/unit/wiki_test.rb index bc5ad8a08..8fa937c53 100644 --- a/test/unit/wiki_test.rb +++ b/test/unit/wiki_test.rb @@ -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') + + page = WikiPage.find(10) + assert_equal page, wiki.find_page('Этика_менеджмента') end def test_titleize -- 2.39.5