comparison app/models/.svn/text-base/wiki.rb.svn-base @ 119:8661b858af72

* Update to Redmine trunk rev 4705
author Chris Cannam
date Thu, 13 Jan 2011 14:12:06 +0000
parents 513646585e45
children cd2282d2aa55 cbce1fd3b1b7
comparison
equal deleted inserted replaced
39:150ceac17a8d 119:8661b858af72
44 44
45 # find the page with the given title 45 # find the page with the given title
46 def find_page(title, options = {}) 46 def find_page(title, options = {})
47 title = start_page if title.blank? 47 title = start_page if title.blank?
48 title = Wiki.titleize(title) 48 title = Wiki.titleize(title)
49 page = pages.find_by_title(title) 49 page = pages.first(:conditions => ["LOWER(title) LIKE LOWER(?)", title])
50 if !page && !(options[:with_redirect] == false) 50 if !page && !(options[:with_redirect] == false)
51 # search for a redirect 51 # search for a redirect
52 redirect = redirects.find_by_title(title) 52 redirect = redirects.first(:conditions => ["LOWER(title) LIKE LOWER(?)", title])
53 page = find_page(redirect.redirects_to, :with_redirect => false) if redirect 53 page = find_page(redirect.redirects_to, :with_redirect => false) if redirect
54 end 54 end
55 page 55 page
56 end 56 end
57 57