aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/user_controller.rb
diff options
context:
space:
mode:
authorfrancis <francis>2007-10-30 17:31:31 +0000
committerfrancis <francis>2007-10-30 17:31:31 +0000
commit326c8c3b26ce95fb60cc3c519e00e1b178fada50 (patch)
treeefb61ca279a95a3f18928120100aff635613d94d /app/controllers/user_controller.rb
parent180ece0c3394c9cdd6de19dfb4860acbed550742 (diff)
Use nicer URLs for user names with funny characters in them.
Diffstat (limited to 'app/controllers/user_controller.rb')
-rw-r--r--app/controllers/user_controller.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 3daab0670..a0ac68443 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -4,11 +4,12 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: user_controller.rb,v 1.4 2007-10-30 14:49:08 francis Exp $
+# $Id: user_controller.rb,v 1.5 2007-10-30 17:31:31 francis Exp $
class UserController < ApplicationController
+ # XXX See helpers/application_helper.rb simplify_url_part fo reverse of expression in SQL below
def show
- @display_users = User.find(:all, :conditions => [ "name = ?", params[:name] ], :order => "created_at desc")
+ @display_users = User.find(:all, :conditions => [ "regexp_replace(replace(lower(name), ' ', '-'), '[^a-z0-9_-]', '', 'g') = ?", params[:simple_name] ], :order => "created_at desc")
end
private