@@ -46,10 +46,10 class Wiki < ActiveRecord::Base | |||
|
46 | 46 | def find_page(title, options = {}) |
|
47 | 47 | title = start_page if title.blank? |
|
48 | 48 | title = Wiki.titleize(title) |
|
49 |
page = pages.first(:conditions => ["LOWER(title) |
|
|
49 | page = pages.first(:conditions => ["LOWER(title) = LOWER(?)", title]) | |
|
50 | 50 | if !page && !(options[:with_redirect] == false) |
|
51 | 51 | # search for a redirect |
|
52 |
redirect = redirects.first(:conditions => ["LOWER(title) |
|
|
52 | redirect = redirects.first(:conditions => ["LOWER(title) = LOWER(?)", title]) | |
|
53 | 53 | page = find_page(redirect.redirects_to, :with_redirect => false) if redirect |
|
54 | 54 | end |
|
55 | 55 | page |
@@ -20,7 +20,7 | |||
|
20 | 20 | require File.expand_path('../../test_helper', __FILE__) |
|
21 | 21 | |
|
22 | 22 | class WikiTest < ActiveSupport::TestCase |
|
23 | fixtures :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions | |
|
23 | fixtures :projects, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions | |
|
24 | 24 | |
|
25 | 25 | def test_create |
|
26 | 26 | wiki = Wiki.new(:project => Project.find(2)) |
@@ -49,6 +49,9 class WikiTest < ActiveSupport::TestCase | |||
|
49 | 49 | |
|
50 | 50 | page = WikiPage.find(10) |
|
51 | 51 | assert_equal page, wiki.find_page('Этика_менеджмента') |
|
52 | ||
|
53 | page = WikiPage.generate!(:wiki => wiki, :title => '2009\\02\\09') | |
|
54 | assert_equal page, wiki.find_page('2009\\02\\09') | |
|
52 | 55 | end |
|
53 | 56 | |
|
54 | 57 | def test_titleize |
General Comments 0
You need to be logged in to leave comments.
Login now